Payment Intents
Create, process, and track payments through their lifecycle
A Payment Intent represents a single payment attempt. The typical flow is:
- Create a payment intent with the amount, currency, and capture method
- Proceed with Yassir Cash as the payment method
- Handle any redirects (OTP verification)
- Check the payment status
For pre-authorization flows, create the intent with captureMethod: "RESERVATION", then capture or release the funds later.
Create Payment Intent#
Creates a new payment intent. Returns a paymentId and clientSecret that you use in subsequent calls.
/api/v1/payments/intentsQuery Parameters#
countryCodestringrequiredDZARequest Body#
actionIdstringrequiredamountnumberrequiredactionCurrencyCodestringrequiredDZD, MAD, USDactionCountryCodestringrequireduserIdstringrequiredcaptureMethodstringoptionalDIRECT.DIRECT — Capture immediately when the payment is processed.RESERVATION — Reserve the funds and capture later via the Capture endpoint.metaDataobjectoptionalpaymentCheckoutId for tracking.Required Headers#
AuthorizationstringrequiredBearer base64(client_id:client_secret)x-platformstringrequiredAPIWEBANDROIDIOSx-servicestringrequiredContent-Typestringrequiredapplication/json.Response#
data.paymentIdstringrequireddata.clientSecretstringrequiredpa_{id}_secret_{hex}data.statusstringrequiredCREATED after initialization.data.amountnumberrequireddata.currencystringrequiredDZD).data.expiresAtstringrequiredcurl -X POST "https://api.payment.yassir.io/api/v1/payments/intents?countryCode=DZA" \
-H "Authorization: Bearer $(echo -n 'your_client_id:your_client_secret' | base64)" \
-H "Content-Type: application/json" \
-H "x-platform: API" \
-H "x-service: YOUR_SERVICE" \
-d '{
"actionId": "order_12345",
"amount": 1500.00,
"actionCurrencyCode": "DZD",
"actionCountryCode": "DZA",
"userId": "user_abc123",
"captureMethod": "DIRECT"
}'curl -X POST "https://api.payment.yassir.io/api/v1/payments/intents?countryCode=DZA" \
-H "Authorization: Bearer $(echo -n 'your_client_id:your_client_secret' | base64)" \
-H "Content-Type: application/json" \
-H "x-platform: API" \
-H "x-service: YOUR_SERVICE" \
-d '{
"actionId": "order_12345",
"amount": 1500.00,
"actionCurrencyCode": "DZD",
"actionCountryCode": "DZA",
"userId": "user_abc123",
"captureMethod": "DIRECT"
}'{
"data": {
"paymentId": "123e4567-e89b-12d3-a456-426614174000",
"clientSecret": "pa_123e4567_secret_a1b2c3d4e5f6a1b2c3d4e5f6",
"status": "CREATED",
"amount": 1500.00,
"currency": "DZD",
"expiresAt": "2026-02-18T10:30:00.000Z"
},
"message": "payment initiated successfully"
}{
"data": {
"paymentId": "123e4567-e89b-12d3-a456-426614174000",
"clientSecret": "pa_123e4567_secret_a1b2c3d4e5f6a1b2c3d4e5f6",
"status": "CREATED",
"amount": 1500.00,
"currency": "DZD",
"expiresAt": "2026-02-18T10:30:00.000Z"
},
"message": "payment initiated successfully"
}Proceed with Payment#
Submits the payment for processing with Yassir Cash. The response may indicate that additional user action is required (OTP verification).
/api/v1/payments/intents/:id/proceedURL Parameters#
idstringrequiredpaymentId returned from the Create Payment Intent endpoint.Request Body#
paymentMethodCodestringrequiredWALLET_V2 for Yassir Cash.Required Headers#
AuthorizationstringrequiredBearer base64(client_id:client_secret)x-platformstringrequiredAPIWEBANDROIDIOSx-servicestringrequiredx-client-secretstringrequiredclientSecret returned from the Create Payment Intent endpoint. Format: pa_{id}_secret_{hex}x-country-codestringoptionalDZAx-localestringoptionalen_USHandling OTP Verification
require3DS is true, redirect the user to the payUrl. Yassir handles the entire OTP flow — sending the SMS, showing the verification page, and validating the code. Append a returnUrl query parameter so the user is redirected back to your app after verification.See the OTP Verification guide for the complete redirect flow.
Response#
data.require3DSbooleanrequiredtrue, redirect the user to payUrl.data.statusCodenumberrequireddata.statusstringrequireddata.metadata.payUrlstringoptionalrequire3DS is true. Append your returnUrl as a query parameter.Status Codes#
| statusCode | Meaning | Action Required |
|---|---|---|
2 | Success | Payment completed. Show success to user. |
3 | Rejected | Payment failed. Show error and allow retry. |
12 | Requires Action | Redirect user to payUrl for OTP verification. |
13 | Pre-Authorized | Funds reserved. Use Capture or Release endpoint. |
curl -X POST "https://api.payment.yassir.io/api/v1/payments/intents/123e4567-e89b-12d3-a456-426614174000/proceed" \
-H "Authorization: Bearer $(echo -n 'your_client_id:your_client_secret' | base64)" \
-H "Content-Type: application/json" \
-H "x-platform: API" \
-H "x-service: YOUR_SERVICE" \
-H "x-client-secret: pa_123e4567_secret_a1b2c3d4e5f6" \
-H "x-country-code: DZA" \
-d '{
"paymentMethodCode": "WALLET_V2"
}'curl -X POST "https://api.payment.yassir.io/api/v1/payments/intents/123e4567-e89b-12d3-a456-426614174000/proceed" \
-H "Authorization: Bearer $(echo -n 'your_client_id:your_client_secret' | base64)" \
-H "Content-Type: application/json" \
-H "x-platform: API" \
-H "x-service: YOUR_SERVICE" \
-H "x-client-secret: pa_123e4567_secret_a1b2c3d4e5f6" \
-H "x-country-code: DZA" \
-d '{
"paymentMethodCode": "WALLET_V2"
}'// statusCode: 12 → Requires OTP verification
{
"data": {
"require3DS": true,
"statusCode": 12,
"status": "Require Authentication Action",
"metadata": {
"payUrl": "https://otp.payment.yassir.io/otp/verify?requestId=...&phone=213555123456&amount=1500¤cy=DZD"
}
},
"message": "payment proceeded successfully"
}// statusCode: 12 → Requires OTP verification
{
"data": {
"require3DS": true,
"statusCode": 12,
"status": "Require Authentication Action",
"metadata": {
"payUrl": "https://otp.payment.yassir.io/otp/verify?requestId=...&phone=213555123456&amount=1500¤cy=DZD"
}
},
"message": "payment proceeded successfully"
}// statusCode: 2 → Payment succeeded immediately
{
"data": {
"require3DS": false,
"statusCode": 2,
"status": "The amount was deposited successfully",
"metadata": {
"payUrl": ""
}
},
"message": "payment proceeded successfully"
}// statusCode: 2 → Payment succeeded immediately
{
"data": {
"require3DS": false,
"statusCode": 2,
"status": "The amount was deposited successfully",
"metadata": {
"payUrl": ""
}
},
"message": "payment proceeded successfully"
}// statusCode: 3 → Payment rejected
{
"data": {
"require3DS": false,
"statusCode": 3,
"status": "Transaction was rejected",
"metadata": {
"payUrl": ""
}
},
"message": "payment proceeded successfully"
}// statusCode: 3 → Payment rejected
{
"data": {
"require3DS": false,
"statusCode": 3,
"status": "Transaction was rejected",
"metadata": {
"payUrl": ""
}
},
"message": "payment proceeded successfully"
}Check Payment Status#
Retrieves the current status of a payment intent. Use this after the user returns from a redirect to confirm the payment result.
/api/v1/payments/intents/:id/checkURL Parameters#
idstringrequiredpaymentId to check.Required Headers#
AuthorizationstringrequiredBearer base64(client_id:client_secret)x-platformstringrequiredAPIWEBANDROIDIOSx-servicestringrequiredx-client-secretstringrequiredclientSecret returned from the Create Payment Intent endpoint.Response#
data.statusCodenumberrequired2 = succeeded, 3 = rejected, 12 = requires action, 13 = pre-authorized).data.paymentMethodNamestringrequiredWALLET_V2).data.amountnumberrequireddata.currencyCodestringrequiredDZD).data.endUserMessagestringrequireddata.supportInfoobjectoptionalemail and phoneNumber.data.lastUpdatestringoptionalcurl -X GET "https://api.payment.yassir.io/api/v1/payments/intents/123e4567-e89b-12d3-a456-426614174000/check" \
-H "Authorization: Bearer $(echo -n 'your_client_id:your_client_secret' | base64)" \
-H "x-platform: API" \
-H "x-service: YOUR_SERVICE" \
-H "x-client-secret: YOUR_CLIENT_SECRET"curl -X GET "https://api.payment.yassir.io/api/v1/payments/intents/123e4567-e89b-12d3-a456-426614174000/check" \
-H "Authorization: Bearer $(echo -n 'your_client_id:your_client_secret' | base64)" \
-H "x-platform: API" \
-H "x-service: YOUR_SERVICE" \
-H "x-client-secret: YOUR_CLIENT_SECRET"{
"data": {
"statusCode": 2,
"paymentMethodName": "WALLET_V2",
"amount": 1500,
"currencyCode": "DZD",
"endUserMessage": "Payment completed successfully",
"supportInfo": {
"email": "support@yassir.com",
"phoneNumber": "+213000000000"
},
"lastUpdate": "2025-01-15T10:30:00.000Z"
},
"message": "payment status retrieved successfully"
}{
"data": {
"statusCode": 2,
"paymentMethodName": "WALLET_V2",
"amount": 1500,
"currencyCode": "DZD",
"endUserMessage": "Payment completed successfully",
"supportInfo": {
"email": "support@yassir.com",
"phoneNumber": "+213000000000"
},
"lastUpdate": "2025-01-15T10:30:00.000Z"
},
"message": "payment status retrieved successfully"
}Capture Payment#
Captures a pre-authorized payment. Only available for payment intents created with captureMethod: "RESERVATION" that have been successfully pre-authorized (statusCode 13).
You can capture less than the reserved amount (partial capture). The remaining unreserved amount is automatically released back to the user.
/api/v1/payments/intents/:id/captureURL Parameters#
idstringrequiredpaymentId of the pre-authorized payment.Request Body#
amountnumberoptionalRequired Headers#
AuthorizationstringrequiredBearer base64(client_id:client_secret)x-platformstringrequiredAPIWEBANDROIDIOSx-servicestringrequiredPartial Capture
# Capture a partial amount (e.g., reserved 5000, capture 4500)
curl -X POST "https://api.payment.yassir.io/api/v1/payments/intents/123e4567-e89b-12d3-a456-426614174000/capture" \
-H "Authorization: Bearer $(echo -n 'your_client_id:your_client_secret' | base64)" \
-H "Content-Type: application/json" \
-H "x-platform: API" \
-H "x-service: YOUR_SERVICE" \
-d '{
"amount": 4500.00
}'# Capture a partial amount (e.g., reserved 5000, capture 4500)
curl -X POST "https://api.payment.yassir.io/api/v1/payments/intents/123e4567-e89b-12d3-a456-426614174000/capture" \
-H "Authorization: Bearer $(echo -n 'your_client_id:your_client_secret' | base64)" \
-H "Content-Type: application/json" \
-H "x-platform: API" \
-H "x-service: YOUR_SERVICE" \
-d '{
"amount": 4500.00
}'{
"data": {
"status": "The amount was deposited successfully",
"statusCode": 2,
"metaData": {
"payUrl": ""
}
},
"message": "payment captured successfully"
}{
"data": {
"status": "The amount was deposited successfully",
"statusCode": 2,
"metaData": {
"payUrl": ""
}
},
"message": "payment captured successfully"
}Release Payment#
Releases a pre-authorized payment without capturing any funds. The full reserved amount is returned to the user's wallet.
/api/v1/payments/intents/:id/releaseURL Parameters#
idstringrequiredpaymentId of the pre-authorized payment.Required Headers#
AuthorizationstringrequiredBearer base64(client_id:client_secret)x-platformstringrequiredAPIWEBANDROIDIOSx-servicestringrequiredcurl -X POST "https://api.payment.yassir.io/api/v1/payments/intents/123e4567-e89b-12d3-a456-426614174000/release" \
-H "Authorization: Bearer $(echo -n 'your_client_id:your_client_secret' | base64)" \
-H "Content-Type: application/json" \
-H "x-platform: API" \
-H "x-service: YOUR_SERVICE" \
-d '{}'curl -X POST "https://api.payment.yassir.io/api/v1/payments/intents/123e4567-e89b-12d3-a456-426614174000/release" \
-H "Authorization: Bearer $(echo -n 'your_client_id:your_client_secret' | base64)" \
-H "Content-Type: application/json" \
-H "x-platform: API" \
-H "x-service: YOUR_SERVICE" \
-d '{}'{
"data": {
"status": "Reversed",
"statusCode": 10,
"metaData": {
"payUrl": ""
}
},
"message": "payment released successfully"
}{
"data": {
"status": "Reversed",
"statusCode": 10,
"metaData": {
"payUrl": ""
}
},
"message": "payment released successfully"
}Refund Payment#
Refund a completed payment, either fully or partially. Yassir Cash supports multiple partial refunds on a single payment — each refund reduces the remaining refundable balance.
/api/v1/payments/:paymentId/refundURL Parameters#
paymentIdstringrequiredRequest Body#
descriptionstringrequiredamountnumberoptionalreasonstringoptionalRequired Headers#
AuthorizationstringrequiredBearer base64(client_id:client_secret)x-platformstringrequiredAPIWEBANDROIDIOSx-servicestringrequiredMultiple Partial Refunds
1. Refund 500 DZD → remaining refundable: 1000 DZD
2. Refund 300 DZD → remaining refundable: 700 DZD
3. Refund 700 DZD → remaining refundable: 0 DZD (fully refunded)
curl -X POST "https://api.payment.yassir.io/api/v1/payments/123e4567-e89b-12d3-a456-426614174000/refund" \
-H "Authorization: Bearer $(echo -n 'your_client_id:your_client_secret' | base64)" \
-H "Content-Type: application/json" \
-H "x-platform: API" \
-H "x-service: YOUR_SERVICE" \
-d '{
"description": "Customer requested full refund"
}'curl -X POST "https://api.payment.yassir.io/api/v1/payments/123e4567-e89b-12d3-a456-426614174000/refund" \
-H "Authorization: Bearer $(echo -n 'your_client_id:your_client_secret' | base64)" \
-H "Content-Type: application/json" \
-H "x-platform: API" \
-H "x-service: YOUR_SERVICE" \
-d '{
"description": "Customer requested full refund"
}'curl -X POST "https://api.payment.yassir.io/api/v1/payments/123e4567-e89b-12d3-a456-426614174000/refund" \
-H "Authorization: Bearer $(echo -n 'your_client_id:your_client_secret' | base64)" \
-H "Content-Type: application/json" \
-H "x-platform: API" \
-H "x-service: YOUR_SERVICE" \
-d '{
"description": "Partial refund for item return",
"amount": 500.00
}'curl -X POST "https://api.payment.yassir.io/api/v1/payments/123e4567-e89b-12d3-a456-426614174000/refund" \
-H "Authorization: Bearer $(echo -n 'your_client_id:your_client_secret' | base64)" \
-H "Content-Type: application/json" \
-H "x-platform: API" \
-H "x-service: YOUR_SERVICE" \
-d '{
"description": "Partial refund for item return",
"amount": 500.00
}'{
"data": {
"statusCode": 4,
"status": "Transaction was refunded",
"paymentOrderId": "ORDER_67890",
"microServiceTransactionId": null,
"errorMessage": {
"internalErrorMessage": null,
"providerErrorMessage": null
}
},
"message": "Payment refunded successfully"
}{
"data": {
"statusCode": 4,
"status": "Transaction was refunded",
"paymentOrderId": "ORDER_67890",
"microServiceTransactionId": null,
"errorMessage": {
"internalErrorMessage": null,
"providerErrorMessage": null
}
},
"message": "Payment refunded successfully"
}{
"data": {
"statusCode": 16,
"status": "Transaction was partially refunded",
"paymentOrderId": "ORDER_67890",
"microServiceTransactionId": null,
"errorMessage": {
"internalErrorMessage": null,
"providerErrorMessage": null
}
},
"message": "Payment refunded successfully"
}{
"data": {
"statusCode": 16,
"status": "Transaction was partially refunded",
"paymentOrderId": "ORDER_67890",
"microServiceTransactionId": null,
"errorMessage": {
"internalErrorMessage": null,
"providerErrorMessage": null
}
},
"message": "Payment refunded successfully"
}