Tokenization

Save a card as a token, then use that token to charge the customer later. This demonstrates the returning-customer flow.

Tokenization lets you store card details securely. Moyasar returns a token_* ID that you use for future payments — you never handle raw card numbers again.
1

Create a Token (Save Card)

Submit card details to Moyasar's tokenization endpoint. The returned token ID represents this card and can be reused for future payments.

3

Pay with Saved Token

Use the token ID from the previous step to create a payment without re-entering card details. This is how returning-customer flows work.

Verify in Dashboard

Open the Moyasar STAGING Dashboard to confirm the token-based payment.

What happened?

  • Step 1: POST /v1/tokens saves the card and returns a token ID.
  • Step 2: POST /v1/payments with source.type: token uses the saved token to charge.
  • The merchant never stores raw card details — the token is the only reference.
  • Tokens have an expiration and scope. Check the Moyasar docs for details on token lifecycle.