Custom Payments

Tokenized Cards

11min

Introduction

Welcome to our guide on using tokens for recurring payments with Moyasar! Tokens are a powerful tool that allows you to securely handle recurring payments without needing to store sensitive payment information on your servers.



Before Starting

To get started with recurring payments, you will first need to learn how to get the token.

To generate a tokenized card, you have 2 options:

  1. Save the card after a successful payment transaction.
  2. Through our Create Token API.

Create A Payment

To initiate a payment using the stored token, send a POST request to https://api.moyasar.com/v1/payments; here is an example using cURL

Sample Request

Curl


Sample Response

JSON


Fetching Card Information

You can use a token to retrieve saved card information to provide your users with good UX. Here is an example of the information you can obtain from the token:

Sample Request

Curl


Sample Response

JSON


This will help your users identify which card is being used for the recurring payment.

Remove Card Information

Sometimes your users may want to remove old or expired cards from their accounts, Tokens will be invalidated when the card reaches its expiration date or by issuing a DELETE request, here is an example:

Sample Request

Curl


Sample Response

You will get an empty response with a 204 HTTP status code.

Resources