Tokenz Checkout
Learn how to use Checkout to collect payments on your website.
Tokenz Checkout is a prebuilt payment form that allows businesses to securely accept payments online. Its built-in features reduce development time. You can accept payments by directing customers to a Tokenz-hosted payment page.
You can customize Checkout and access additional functionality with the Checkout Session API.
Checkout Lifecycle
- When customers are ready to complete their purchase, your application creates a new Checkout Session.
- The Checkout Session provides a URL that redirects customers to a Tokenz-hosted payment page.
- Customers enter their payment details on the payment page and complete the transaction.
- After the transaction, a webhook fulfills the order using the
order.succeeded
event
Checkout Session
The Checkout Session is a programmatic representation of what your customers see on the payment form. After creating a Checkout Session, redirect your customers to the Session's URL to complete the purchase. When customers complete their purchases, you can fulfill their orders by configuring webhooks on Order events. This code snippet is an example of creating a Checkout Session in your application.
curl --request POST \
--url https://api.tokenz.one/v1/checkoutsession \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {YOUR_TOKEN}' \
--data '{
"amount": {
"amount": 1000,
"currency": "JPY"
},
"itemDetails": [
{
"product": {
"price": {
"amount": 1000,
"currency": "JPY"
},
"quantity": 1,
"label": "Treasure Chest",
}
}
],
"successUrl": "https://example.com/success",
"pendingUrl": "https://example.com/pending",
"cancelUrl": "https://example.com/cancel",
"customerInfo": {
"customerId": "customer_123"
},
"description": "",
"reference": "order_123"
}'
Payment Methods
You can customize what payment methods to offer to your customers on the Tokenz-hosted payment page. Send one or more supported options in the paymentMethodKinds
argument to limit the customer's choice. If the argument is not included or an empty list is sent, all supported payment methods are displayed.