Create Card Token
Create a hosted page for a customer to save card details and manage cards.
Prerequisites
Note
Certain card operations on the hosted page require 3DS authentication by the cardholder. To simulate the cardholder's action in the sandbox, see Simulating 3DS Authentication.
Before you run this method, verify that the payment method can be tokenized. See List Payment Methods by Country.
Rapyd sends you webhooks for the following customer actions:
Add a card.
Customer Payment Method Created Webhook - Contains the same information as the response to Add Payment Method to Customer.
Customer Updated Webhook - Contains the same information as the response to Update Customer.
Payment Succeeded Webhook (card verification) - Contains the same information as the response to Create Payment.
Change the default card.
Customer Updated Webhook - Contains the same information as the response to Update Customer.
Delete a card.
/v1/hosted/collect/card
Create Card Token
curl -X post https://sandboxapi.rapyd.net/v1/hosted/collect/card -H 'access_key: your-access-key-here' -H 'Content-Type: application/json' -H 'idempotency: your-idempotency-parameter-here' -H 'salt: your-random-string-here' -H 'signature: your-calculated-signature-here' -H 'timestamp: your-unix-timestamp-here' -d '{ "country": "gb", "customer": "cus_42b8ceab15da92c5d4dd746b41b12334", "card_fields": { "recurrence_type": "unscheduled" } } '
{ "status": { "error_code": "", "status": "SUCCESS", "message": "", "response_code": "", "operation_id": "1ac79b55-b445-44ae-bcb6-ad2db4388d6d" }, "data": { "id": "hp_card_2462697b00c0419f1446e74f8cc8633f", "status": "NEW", "cancel_url": "https://www.rapyd.net", "complete_url": "https://www.rapyd.net", "language": null, "merchant_color": "324cff", "merchant_logo": "https://qaiconslib.rapyd.net/merchant-logos/ohpc_61a8582e4690e8fe5345b10e5d7321ca/sbox.jpg", "merchant_website": "https://www.rapyd.net", "merchant_customer_support": { "url": "https://www.rapyd.net", "email": "rapyd@rapyd.net", "phone_number": "524-444444444" }, "merchant_alias": "rap", "page_expiration": 1706091974, "redirect_url": "https://sandboxhosted.rapyd.net/collect/card?token=hp_card_2462697b00c0419f1446e74f8cc8633f", "category": "card", "country": "GB", "currency": "GBP", "customer": "cus_42b8ceab15da92c5d4dd746b41b12334", "payment_method_type": null, "payment_params": { "complete_payment_url": null, "error_payment_url": null }, "billing_address_collect": false, "customer_card_payment_methods": null, "card_fields": { "recurrence_type": "unscheduled" } } }