Tokenised Card payments
Overview
Cards are tokenised when a customer makes a payment and saves his card for future payments.
You can also set force_recurring = true
when creating a purchase to automatically tokenise the customer's card without any interaction.
Generating and using card token
When creating a purchase where you want to store the client token generated, the ID of the Client object is used to initialize ClientDetails (.client) of this Purchase.
Either this field or specifying .client object is required (you can only specify a value for one of these fields). All ClientDetails fields from the Client will be copied to the .client object. Note that editing Client object won't change the respective fields in already created Purchases.
curl -X 'POST' \
'https://gate.reviopay.com/api/v1/purchases/' \
-H 'Authorization: Bearer va-7b7EyQ9qcovWst4KpJW9wZo12x3Hh7NBW7B_AG52v4y8YlMe0HKPg6TR_klO39nOj7VoIq6vDbMtSo76YXQ==' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"purchase": {
"products": [
{
"name": "test",
"price": 100
}
]
},
"brand_id": "5c523a6d-cad0-462e-b9bb-79b16495f3b9",
"client_id": "98e9cf98-dbd4-4a84-a304-dffbda2bef19",
"force_recurring": true
}'
curl -X 'GET' \
'https://gate.reviopay.com/api/v1/clients/{{client_id}}/recurring_tokens/' \
-H 'Authorization: Bearer {{Your Revio Bearer token}}' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json'
curl -X 'POST' \
'https://gate.reviopay.com/api/v1/purchases/{{Upcoming purchase_id}}/charge/' \
-H 'Authorization: Bearer {{Your Revio Bearer token}}' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"recurring_token": "82e6eb62-90e8-405c-9ec9-d43affba41d2"
}'
A client can have multiple recurring tokens stored against their id.
{
"next": null,
"previous": null,
"results": [
{
"payment_method": "mastercard",
"description": "555555******4444",
"created_on": 1663425652,
"updated_on": 1663425652,
"type": "client_recurring_token",
"id": "82e6eb62-90e8-405c-9ec9-d43affba41d2"
}
]
}
Updated over 1 year ago