To start tokenization of cards for Upodi, please read the following guidance for Stripe. On your implementation side, implement a checkout page. You will also have to connect your Stripe account to Upodi.


Please check your environments

Whether Upodi is in sandbox or production mode, Upodi will connect to your production instance of Stripe. All tests have to occur in Stripe production mode. Test customers and payment methods are not in scope for Upodi.

If Upodi is in sandbox mode, no actual payment is conducted in Stripe.

Create a Customer

OBS - This is required by Stripe to allow recurring payments.. When created use the customer.Id parameter as {{CUSTOMER_ID}} in the checkout session.

curl \
  -u sk_your_stripe_prodution_key: \
  -d description="My First Upodi customer"

Create a Checkout session

To create a setup mode Session, use the mode parameter with a value of setup when creating the Session. You can optionally specify the customer parameter to automatically attach the created payment method to an existing customer. See the Checkout Session API reference for a complete list of parameters that you can use for Session creation.

Append the {CHECKOUT_SESSION_ID} template variable to the success_url to get access to the Session ID after your customer successfully completes a Checkout Session. After creating the Checkout Session, redirect your customer to the URL returned in the response.

curl \
  -u sk_your_stripe_prodution_key: \
  -d "payment_method_types[]"="card" \
  -d "mode"="setup" \
  -d "customer"="{{CUSTOMER_ID}}" \
  -d "success_url"="{CHECKOUT_SESSION_ID}" \
  -d "cancel_url"=""

Retrieve the Checkout session

After a customer successfully completes their Checkout Session, you need to retrieve the Session object. There are two ways to do this:

  • Asynchronously: Handle checkout.session.completed webhooks, which contain a Session object. Learn more about setting up webhooks.
  • Synchronously: Obtain the sessionId from the URL when a user redirects back to your site (appended to the success_url) and retrieve the Session object.
curl \
  -u sk_your_stripe_prodution_key:

After you have retrieved the Session object, get the value of the setup_intent key, which is the ID for the SetupIntent created during the Checkout Session. A SetupIntent is an object used to set up the customer’s bank account information for future payments.

Check that the Checkout session status is completed.

Retrieve the Setup Intent

Using the setup_intent ID, retrieve the SetupIntent object. The returned object contains a payment_method ID, the ID of the SetupIntent and the required ID of Customer..

curl \
  -u sk_your_stripe_prodution_key:

Create token in Upodi

To create a payment method for Stripe token, make a POST request to our PaymentMethods API. Upodi actually supports both the cus_, seti_ orthe pm_ tokens. Each must be assigned to a customer.

    "gateway" :"stripe"
    , "source" : "cus_FmguAmvkiqr3wh" /* Stripe customer ID */
    , "customerid" : "{provide upodi customer id here}"
    , "makedefault" : true