Create a payment method from token
/payment_methods/create_from_tokenCreates a card payment method for a customer from a Pay.com card token (tok_card_) or from the reference of a card imported with POST /payment_methods/import.
Headers
AuthorizationstringRequiredidempotency-keystringA unique key, such as a UUID, that makes a POST or DELETE request safe to retry. Pay.com keeps each key for 24 hours, separately for each workspace.
- A retry with the same key, endpoint and body gets the first request's stored status and body, without running the request again.
- If the first request is still being processed, a retry gets 409
idempotency_error(request_in_progress). - The same key on another endpoint, or with another body, gets 400
idempotency_error(invalid_parameters). - GET, PUT and PATCH requests ignore the key.
The response repeats the key in its Idempotency-Key header.
Parameters
customer_reference_idstringRequiredYour unique identifier for the customer that the payment method belongs to.
tokenstringRequiredA Pay.com card token (tok_card_), or the reference of a card imported with POST /payment_methods/import.
metadataobjectSet of key-value pairs attached to the object.
Returns
Returns the created payment method object.
idstringUnique identifier for the payment method.
resourcestringString representing the object's type.
typestringThe type of the payment method. Always card.
cardobjectDetails of the card. Fields that are not known are null.
Show 14 child attributesHide child attributes
binstring or nullThe first six digits of the card number.
brandstring or nullThe brand of the card.
cardholder_currencystring or nullThree-letter ISO currency code of the cardholder's card, in lowercase.
countrystring or nullTwo-letter ISO code of the country of the card issuer.
exp_monthstring or nullTwo-digit string representing the card's expiration month.
exp_yearstring or nullFour-digit string representing the card's expiration year.
fingerprintstring or nullUnique identifier for this card number.
fundingstring or nullThe funding type of the card.
last4string or nullThe last four digits of the card number.
networkstring or nullThe card network.
tokenstringThe card token.
three_d_securenullsecurity_checksnullwalletobject or nullDigital wallet of the token (type googlepay or applepay), if applicable.
Show 1 child attributeHide child attributes
typestringType of the digital wallet.
flow_directionsobjectSupported flow directions.
Show 2 child attributesHide child attributes
paymentbooleanWhether the payment method can be used for payments.
payoutbooleanWhether the payment method can be used for payouts.
test_modebooleanWhether the payment method was created in the sandbox.
statusnullreferencestring or nullThe payment method's ID at the provider it was imported from, if applicable.
metadataobjectSet of key-value pairs attached to the object.
Errors
400Invalid token provided when token is a payment method ID (pm_) rather than a token.401invalid_key, invalid_token, legacy_keys_ended, legacy_keys_off or permission_denied).403resource_not_allowed, key_disabled, network_not_allowed, pci_required or merchant_required), or this resource isn't enabled for your account (permission_denied). code says why.409idempotency-key is still being processed (request_in_progress). Wait, then retry with the same key.422token is an external token that is not stored for your account (No card was found for external payment method id).500503Retry-After, or after a few seconds when there's none.