Token was successfully read.
- Update customer token status
Payments API V1 (1.0.0)
The Customer Token API is used to charge customers with a tokenized payment method and can be used for recurring purchases, subscriptions and for storing a customer's payment method. Tokens are created using the generate a customer token call in the payments API.
Read more on Klarna payments.
Request
Use this API request to retrieve the content of a Kustom customer token. The request will return the status of the token as well as payment method details. To learn more, refer to the Read customer tokens details article.
- https://api.kustom.co/customer-token/v1/tokens/{customerToken}
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
'https://api.kustom.co/customer-token/v1/tokens/{customerToken}'{ "card": { "brand": "VISA", "expiry_date": "12/2020", "masked_number": "************1234" }, "direct_debit": { "masked_number": "**********124" }, "payment_method_type": "INVOICE", "status": "ACTIVE" }
Request
Use this API call to create an order using a Kustom Customer Token. Make sure you use the correct token ID when placing an order, to ensure that the right consumer gets billed. Read more on Create a new order using the customer token.
Pass through field (max 6000 characters).
Used for storing merchant's internal order number or other reference. If set, will be shown on the confirmation page as "order number" (max 255 characters).
Used for storing merchant's internal order number or other reference (max 255 characters).
Non-negative, minor units. Total amount of the order, including tax and any discounts.
The applicable order lines (max 1000)
- https://api.kustom.co/customer-token/v1/tokens/{customerToken}/order
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
'https://api.kustom.co/customer-token/v1/tokens/{customerToken}/order' \
-H 'Content-Type: application/json' \
-H 'Klarna-Idempotency-Key: string' \
-d '{
"attachment": {
"body": "{\"customer_account_info\":[{\"unique_account_identifier\":\"test@gmail.com\",\"account_registration_date\":\"2017-02-13T10:49:20Z\",\"account_last_modified\":\"2019-03-13T11:45:27Z\"}]}",
"content_type": "application/vnd.klarna.internal.emd-v2+json"
},
"auto_capture": false,
"merchant_data": "{\"order_specific\":[{\"substore\":\"Women'\''s Fashion\",\"product_name\":\"Women Sweatshirt\"}]}",
"merchant_reference1": "ON4711",
"merchant_reference2": "ON4711",
"merchant_urls": {
"confirmation": "string",
"push": "string"
},
"order_amount": 1,
"order_lines": [
{
"image_url": "https://www.exampleobjects.com/logo.png",
"merchant_data": "{\"customer_account_info\":[{\"unique_account_identifier\":\"test@gmail.com\",\"account_registration_date\":\"2017-02-13T10:49:20Z\",\"account_last_modified\":\"2019-03-13T11:45:27Z\"}]}",
"name": "Running shoe",
"product_identifiers": {
"brand": "shoe-brand",
"category_path": "Shoes > Running",
"global_trade_item_number": "4912345678904",
"manufacturer_part_number": "AD6654412-334.22",
"color": "white",
"size": "small"
},
"product_url": "https://.../AD6654412.html",
"quantity": 1,
"quantity_unit": "pcs",
"reference": "AD6654412",
"tax_rate": 1900,
"total_amount": 2500,
"total_discount_amount": 500,
"total_tax_amount": 475,
"type": "physical",
"unit_price": 2500,
"subscription": {
"name": "string",
"interval": "DAY",
"interval_count": 1
}
}
],
"order_tax_amount": 0,
"purchase_currency": "GBP",
"shipping_address": {
"attention": "Attn",
"city": "London",
"country": "GB",
"email": "test.sam@test.com",
"family_name": "Andersson",
"given_name": "Adam",
"organization_name": "string",
"phone": "+44795465131",
"postal_code": "W1G 0PW",
"region": "OH",
"street_address": "33 Cavendish Square",
"street_address2": "Floor 22 / Flat 2",
"title": "Mr."
}
}'Order was successfully created.
Fraud status for the order. Either ACCEPTED or PENDING. If ACCEPTED, the order could be captured. If PENDING, please wait till you receive the notification from Kustom in the notification URL that the order has been approved. You can find additional information here.
Unique order ID of the transaction. This ID will be used for all order management processes.
URL to redirect the customer to after placing the order. This is a Kustom URL to which the merchant should redirect the customer to. Kustom will place a cookie in the customer’s browser (if redirected) and redirect the customer back to the confirmation URL provided by the merchant. This is not a mandatory step but a recommended one to improve the returning customer’s experience. It is a spontaneous step and does not harm the customer’s experience.
{ "authorized_payment_method": { "number_of_days": 0, "number_of_installments": 0, "type": "invoice" }, "fraud_status": "string", "order_id": "string", "redirect_url": "https://credit.klarna.com/v1/sessions/0b1d9815-165e-42e2-8867-35bc03789e00/redirect" }
Request
Use this API call to update the status of a Kustom Customer Token. This should be used if you want to cancel a specific customer token. Read more on Update the status of a customer token.
- https://api.kustom.co/customer-token/v1/tokens/{customerToken}/status
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X PATCH \
'https://api.kustom.co/customer-token/v1/tokens/{customerToken}/status' \
-H 'Content-Type: application/json' \
-d '{
"status": "CANCELLED"
}'