Checkouts
Use the Checkouts resource when creating subscription orders using Recharge's Custom integration to compile and send an order to Recharge for processing.
This guide should not be used with stores on the Shopify Checkout Integration.
Understanding Checkouts
Using this resource, process a checkout via your own application only using the Checkouts resource to finalize payment. Normally, each of the separate API resources are updated as a customer goes through the out-of-the-box Recharge checkout workflow (customers, addresses, subscriptions, etc), but you can use the Checkouts resource to send all of this data to Recharge in one call.
The following table details which scopes are required to read and write the checkouts record.
Scope | Description |
---|---|
read_checkouts | Required to retrieve a checkout. |
write_checkouts | Required to modify or update checkout. |
Creating a Checkout and redirecting to Recharge
The main function of the Checkouts resource is sending the customer's order data to Recharge for processing. You'd do this by collecting customer order information from a front-end, then compiling the JSON and sending it in a POST
to Checkouts. You will then receive a token
in the callback request and can use this token to create a URL that lets the customer complete payment on Recharge's Hosted Checkout.
Creating a Checkout and processing checkout externally
You can also process a checkout externally from Recharge and send a payment token to the Checkouts resource to finalize the order. Bear in mind that you are responsible for securing the customer's payment information and PCI compliance. For more information, see Self-Hosted Checkout.
Using the Checkout resource
Checkout resource is usually used when you have a custom built storefront from which you want to redirect customers to the checkout so they can complete their purchase. It gives you a full control over the checkout object so you can improve your customers experience. In order to communicate with the Recharge API you will need a middleware application that will use some back-end language to handle communication between the API and your front-end.
The following provides steps on how to use Checkout resource for the two most common use cases. The main difference between these two use cases is that in the first one you are redirecting the customer to Recharge UI checkout billing page where they will complete their purchase, while in the second one you need custom-built UI checkout to which you will redirect customers and you can process the checkout via the API.
Redirecting to Recharge UI checkout billing page
- Create checkout
- Update checkout
- Retrieve checkout
- Redirect to Recharge UI Checkout
You can use the token
you received on checkout creation to redirect your customers to the Recharge checkout, where they can complete the process by entering their info. This is what the link would look like: > https://checkout.rechargeapps.com/r/checkout/<token>?myshopify_domain=<your_shopify_domain>
> > Your Shopify domain should look something like this: <name specific to your shop>.myshopify.com
. You can easily spot it in the root URL of your Shopify admin.
Using a custom built UI checkout
- Create checkout
- Update checkout
- Retrieve checkout
- Retrieve shipping rates for a checkout
- Update the checkout with shipping rates
- Process checkout
Mobile payments with Checkout
When using mobile payment apps with checkout, the full shipping address is not available until after the checkout is processed. If a partial shipping address is provided when creating or updating a checkout then it will result in validation errors.
To temporarily bypass shipping address validations for a Mobile Payment checkout pass the 'partial_shipping' URL parameter when creating or updating a checkout. See more details below.
Supported mobile payment types are Apple Pay and Google Pay.
How-to add partial shipping parameters to a checkout
Standard shipping_address
validation may be bypassed for Mobile Payment checkouts, where address data is not yet available. To bypass certain shipping_address
validations, pass the partial_shipping
query parameter in the URL when updating the checkout.
HTTP Example URL
Checkout create:
PUT /checkouts/<token>?partial_shipping=1
Checkout update:
POST /checkouts/?partial_shipping=1
Updated 7 months ago