Skip to main content

Add Card

POST 

/api/v2/consumer_portal/profile/cards

Add a new card for the authenticated consumer. Two gateway-dependent flows share this endpoint.

Moyasar (pgw_payment_id set): the frontend already ran a 1 riyal verification transaction client-side and hands back its payment id. This:

  1. Fetches and validates the Moyasar payment transaction
  2. Extracts card details from the payment response
  3. Creates card token record with organization consumer ID
  4. Voids the 1 riyal verification amount
  5. Returns the new card ID

MyFatoorah (pgw_payment_id omitted): there's no payment yet, so this instead creates a zero-charge MyFatoorah Verify session and returns session_id/session_expiry for the frontend to embed in MyFatoorah's session-based payment SDK. The card isn't saved yet -- completion happens later, asynchronously, via MyFatoorah's redirect, callback, or webhook (see ConsumerPortalService.complete_myfatoorah_card_tokenization). Only supported for organizations on a gateway with a native verify operation (currently MyFatoorah).

Request​

Responses​

Successful Response