After the payment

Learn how to fulfill the order or provide access to your services after the customer completes the payment

When your customer successfully completes a Beanie Session, we redirect them to the URL you specified in thesuccess_urlparameter, that should represent a page you host to inform your customer that the payment was successful.

Now, you want to fulfill the customer's order, to deliver them the goods or services they paid for. This guide explains how to deal with this scenario.

Listening to the transaction_details parameter

The redirect tosuccess_urlcomes along with thetransaction_detailsGET parameter, that contains a hash of relevant data to reconciliate the current visitor with a customer from your database and their order.

Decoding to the transaction_details parameter

Thetransaction_detailsGET parameter, consists in aJWTencoded with your Octobat secret API key, using the HS256 algorithm.

Using your library of your choice, decode the JWT token to get the following data:

  beanie: {
    order_id: 'oc_beanie_or_xxxxxxxxxxxxx', // Beanie Order ID
    livemode: true,
    customer_id: 'oc_cu_xxxxxxxxxxxxxx', // Octobat Customer ID
    client_reference_id: 'CU_ZZZZZZZZZZ' // Internal reference, passed as a parameter to the redirectToBeanie function
  transaction: {
    gateway: 'stripe',
    type: "payment_intent",
    id: 'pi_yyyyyyyyyyyyyyy', // Stripe payment intent ID
    customer_id: 'cus_yyyyyyyyyyyy', // Stripe customer ID, if used
  iat: 1574767079 // Timestamp of JWT