Two clicks feature allows you to capture customer's card number, expiry date, email and phone number as a TWO_CLICKS_TOKEN
. For successive payments by the same customer the TWO_CLICKS_TOKEN
can be utilized to pre-fill the details. Customer just needs to fill out the CVV number to finish the payment.
To activate subscriptions/recurring for your merchant account in production, please reach out to your Midtrans PIC or Support team.
There are two steps required to utilize two clicks feature:
Initial Transaction
- Create
SNAP_TOKEN
withcredit_card.save_card
value set totrue
- Customer will be presented with save option when they fill out the credit card details
- If customer chooses the save option, then the Transaction Result will have two extra fields namely
saved_token_id
(referred asTWO_CLICKS_TOKEN
) andsaved_token_id_expired_at
Sample Implementation
{
"transaction_details": {
"order_id": "ORDER-101",
"gross_amount": 10000
},
"credit_card": {
"secure": true,
"save_card": true
}
}
Example of HTTP Post Payment Notification
{
"status_code": "200",
"status_message": "Success, Credit Card 3D Secure transaction is successful",
"transaction_id": "f50c0aef-b629-4a5b-957b-4c52f45e2e63",
"order_id": "A87550",
"payment_type": "credit_card",
"transaction_time": "2014-08-25 11:21:48",
"transaction_status": "capture",
"fraud_status": "accept",
"masked_card": "481111-1114",
"saved_token_id": "4811117d16c884-2cc7-4624-b0a8-10273b7f6cc8",
"saved_token_id_expired_at": "2024-08-25 11:21:48",
"approval_code": "1408940508666",
"gross_amount": "145000.00",
"eci": "05"
}
Successive Transactions
- Create
SNAP_TOKEN
withcredit_card.card_token
value set toTWO_CLICKS_TOKEN
saved during the initial transaction - Customer will be presented with pre-filled credit card number, expiry date, email and phone number
Sample Implementation
{
"transaction_details": {
"order_id": "ORDER-101",
"gross_amount": 10000
},
"credit_card": {
"secure": true,
"card_token": "4811117d16c884-2cc7-4624-b0a8-10273b7f6cc8"
}
}