This feature is only available to merchants on the Growth and Advanced Cloud Vault plans. Please reach out to our support team to get your PSP set up for tokenization.

Provision a PSP token

Once a payment method has been stored, it can be converted into a token for any PSP supported by Gr4vy. To do this, we will need to set up your PSP as a connection, after which you can call the provisioning API to create a token.

curl -i -X POST "https://api.vault.gr4vy.app/payment-methods/{payment_method_id}/payment-service-tokens
" \
    -H "Authorization: Bearer [JWT_TOKEN]" \
    -H "Content-Type: application/json" \
    -d '{
            "payment_service_id": "332a6c3a-c4eb-45f6-9a4e-72af459535e2"
        }'
    

The resulting response includes the token received from the PSP.

{
  "id": "d6ad71d5-6908-45d6-ab65-39c55475dd08",
  "type": "payment-service-token",
  "payment_method_id": "9bdc4bc4-005e-4658-8eee-a309fc43cd4d",
  "payment_service_id": "50f2e61f-caac-4e12-8d79-30eaf8250423",
  "status": "succeeded",
  "approval_url": null,
  "token": "pm123567",
  "created_at": "2021-01-01T12:34:00.000+00:00",
  "updated_at": "2021-01-01T12:34:00.000+00:00"
}

For more details on provisioning PSP tokens, please see our API reference.