Cards
List and delete a customer's saved cards
These endpoints manage the Visa / Mastercard cards saved to a customer's account. They are called in a user-authenticated context (the customer's access token), not with your service client credentials.
Cards are saved automatically
A card is saved to the customer's account automatically when they pay with a new card on the hosted card page — you do not save it yourself. See the Card Payments guide. Saved cards also appear inline in the Payment Methods list.
List Cards#
Returns the cards saved to the customer's account.
GET
/api/v1/cardsBearer Token
List the customer's saved cards.
Query Parameters#
pmCodestringoptionalFilter by payment method code (the card method's
code).Required Headers#
AuthorizationstringrequiredBearer authentication.
x-client-tokenstringrequiredThe customer's access token.
x-servicestringrequiredYour service code.
x-platformstringrequiredThe platform making the request.
Allowed values:
APIWEBANDROIDIOSResponse Fields#
data[].idstringrequiredThe saved card's ID. Use this as
cardId when proceeding with a payment.data[].brandstringrequiredThe card brand. Example:
visadata[].numberstringrequiredThe last four digits of the card. Example:
3456data[].expMonthnumberoptionalThe card expiration month.
data[].expYearnumberoptionalThe card expiration year.
data[].isMostRecentlyUsedbooleanoptionalWhether this is the most recently used card.
List Cards
curl "https://api.payment.yassir.io/api/v1/cards" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "x-client-token: CUSTOMER_ACCESS_TOKEN" \
-H "x-service: YOUR_SERVICE" \
-H "x-platform: API"curl "https://api.payment.yassir.io/api/v1/cards" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "x-client-token: CUSTOMER_ACCESS_TOKEN" \
-H "x-service: YOUR_SERVICE" \
-H "x-platform: API"200 OK
{
"data": [
{
"id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
"paymentMethodId": "1330fa89-4115-43b1-b34d-0e3df2e6a5ba",
"customerId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"brand": "visa",
"number": "3456",
"expMonth": 4,
"expYear": 2028,
"isMostRecentlyUsed": true
}
],
"message": "card listed successfully"
}{
"data": [
{
"id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
"paymentMethodId": "1330fa89-4115-43b1-b34d-0e3df2e6a5ba",
"customerId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"brand": "visa",
"number": "3456",
"expMonth": 4,
"expYear": 2028,
"isMostRecentlyUsed": true
}
],
"message": "card listed successfully"
}Delete a Card#
Removes a saved card from the customer's account.
DELETE
/api/v1/cards/:idBearer Token
Delete a saved card.
URL Parameters#
idstringrequiredThe card ID (the
data[].id from List Cards).Required Headers#
AuthorizationstringrequiredBearer authentication.
x-client-tokenstringrequiredThe customer's access token.
x-country-codestringrequiredISO 3166-1 alpha-3 country code.
Delete a Card
curl -X DELETE "https://api.payment.yassir.io/api/v1/cards/d290f1ee-6c54-4b01-90e6-d701748f0851" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "x-client-token: CUSTOMER_ACCESS_TOKEN" \
-H "x-country-code: DZA"curl -X DELETE "https://api.payment.yassir.io/api/v1/cards/d290f1ee-6c54-4b01-90e6-d701748f0851" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "x-client-token: CUSTOMER_ACCESS_TOKEN" \
-H "x-country-code: DZA"200 OK
{
"data": null,
"message": "card deleted successfully"
}{
"data": null,
"message": "card deleted successfully"
}