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:
- Fetches and validates the Moyasar payment transaction
- Extracts card details from the payment response
- Creates card token record with organization consumer ID
- Voids the 1 riyal verification amount
- 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
- 200
- 422
Successful Response
Validation Error