Skip to main content

Documentación

Create Card Token

Create a hosted page for a customer to save card details and manage cards.

Prerequisites

Nota

  • 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.

  • In the sandbox, card tokens are removed after six months.

Rapyd sends you webhooks for the following customer actions:

  • /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' \
    --data-raw '{
        "country": "GB",
        "customer": "cus_4e25112ac20e144ad073a614dc46934b",
        "complete_payment_url": "https://complete.rapyd.net/",
        "error_payment_url": "https://error.rapyd.net/",
        "card_fields": {
            "recurrence_type": "unscheduled"
        }
    }'
  • {
        "status": {
            "error_code": "",
            "status": "SUCCESS",
            "message": "",
            "response_code": "",
            "operation_id": "1c1bb5dc-4712-4afe-a253-b17ca129855f"
        },
        "data": {
            "id": "hp_card_dffdf3cfaa42472779c75f3e869ae964",
            "status": "NEW",
            "cancel_url": "https://example1234.net",
            "complete_url": "https://example1234.net",
            "language": null,
            "merchant_color": "323fff",
            "merchant_logo": null,
            "merchant_website": "https://example1234.net",
            "merchant_customer_support": {
                "url": "https://example1234.net",
                "email": "support@example1234.net",
                "phone_number": "121255551213"
            },
            "merchant_alias": "Doc Team",
            "page_expiration": 1764770507,
            "redirect_url": "https://sandboxhosted.rapyd.net/collect/card?token=hp_card_dffdf3cfaa42472779c75f3e869ae964",
            "category": "card",
            "country": "GB",
            "currency": "GBP",
            "customer": "cus_4e25112ac20e144ad073a614dc46934b",
            "payment_method_type": null,
            "payment_params": {
                "complete_payment_url": "https://complete.rapyd.net/",
                "error_payment_url": "https://error.rapyd.net/"
            },
            "billing_address_collect": false,
            "customer_card_payment_methods": null,
            "auto_set_default": false,
            "card_fields": {
                "recurrence_type": "unscheduled"
            }
        }
    }
Related Information