Saved Cards

Reference pages: Save a card and charge it later, Capture Buyer Token, Generate Sale with Token, Get Buyer Key, Create Marketplace Token.

A token stands in for a card (TOK-01). Before you save one, you need a first Checkout to capture the card.

Getting one

Way Who You get Notes
capture_buyer: "1" on generate-sale Both buyer_key Captured as part of the payment. Can't be combined with buyer_key on one request. A direct seller also sends buyer_is_private: true: see below
Hosted Fields tokenize() Both token, used as buyer_key tokenIsPermanent: false makes it single-use
sale_type: "token" on generate-sale Both buyer_key The buyer enters a card and nothing is charged
capture-buyer-token PCI DSS certified only buyer_key Takes a raw card (TOK-03)
sale_type: "seller-token" on generate-sale Partner uuid A hosted page that captures a marketplace token
POST /sellers/{mpl}/tokens Partner, PCI DSS certified uuid Takes a raw card

Getting it safely after a sale

Which credential get-buyer-key takes depends on how the token was captured:

Token get-buyer-key with Seen in the sandbox
Sale sent buyer_is_private: true The seller's MPL status_code: 0
Sale sent no buyer_is_private, or a marketplace token payme_client_key and no seller_payme_id status_code: 0. With the MPL, alone or with the partner key, it fails with error 603

So a direct seller, which has no partner key, must send buyer_is_private: true on generate-sale, or it can't read the token back.

Scope and lifetime

Charging one

You hold Send on generate-sale
A buyer_key buyer_key
A marketplace uuid token. Sent as buyer_key, it failed with error 600 in the sandbox

Removing one

These docs list no call to revoke a token. Delete it from your store, and that is what "remove this card" means. Let the buyer see the saved card (buyer_card_mask) and delete it.

Test the failure

To test "the saved card stopped working", use 4000000000000036 (Test Cards and Payment Methods). It only reaches the charge if the token comes from Hosted Fields:

Way in What happened in the sandbox
Hosted Fields tokenize(), then pay-sale with the token Token created, then the charge failed with 20004 and the sale became failed. Use this one
Hosted page, with capture_buyer or sale_type: "token" Declined at once with 20004, and no token exists

If you didn't build Hosted Fields, there's no way to run this without raw card data (TOK-03). Test your handling of a refused charge with a fake PayMe, and report the real decline as not proven.