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 Wallet 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.
/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
AuthorizationstringrequiredBasic base64(client_id:client_secret)x-platformstringrequiredAPIWEBANDROIDIOSx-servicestringrequiredContent-Typestringrequiredapplication/json.Example Request
curl -X POST "https://api.payment.yassir.io/payments/intents?countryCode=DZA" \
-H "Authorization: Basic $(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/payments/intents?countryCode=DZA" \
-H "Authorization: Basic $(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"
}'Response
{
"data": {
"paymentId": "123e4567-e89b-12d3-a456-426614174000",
"clientSecret": "pa_abc123_secret_xyz789",
"status": "pending",
"amount": 1500.00,
"currency": "DZD"
},
"message": "payment initiated successfully"
}{
"data": {
"paymentId": "123e4567-e89b-12d3-a456-426614174000",
"clientSecret": "pa_abc123_secret_xyz789",
"status": "pending",
"amount": 1500.00,
"currency": "DZD"
},
"message": "payment initiated successfully"
}data.paymentIdstringrequireddata.clientSecretstringrequireddata.statusstringrequiredpending after creation.data.amountnumberrequireddata.currencystringrequiredProceed with Payment
Submits the payment for processing with Yassir Wallet. The response may indicate that additional user action is required (OTP verification).
/payments/intents/:id/proceedURL Parameters
idstringrequiredpaymentId returned from the Create Payment Intent endpoint.Request Body
paymentMethodCodestringrequiredWALLET_V2 for Yassir Wallet.Required Headers
AuthorizationstringrequiredBasic base64(client_id:client_secret)x-platformstringrequiredAPIWEBANDROIDIOSx-servicestringrequiredx-client-tokenstringrequiredExample Request
curl -X POST "https://api.payment.yassir.io/payments/intents/123e4567-e89b-12d3-a456-426614174000/proceed" \
-H "Authorization: Basic $(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-token: user_token_here" \
-d '{
"paymentMethodCode": "WALLET_V2"
}'curl -X POST "https://api.payment.yassir.io/payments/intents/123e4567-e89b-12d3-a456-426614174000/proceed" \
-H "Authorization: Basic $(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-token: user_token_here" \
-d '{
"paymentMethodCode": "WALLET_V2"
}'Response - Direct Success
When the payment completes immediately (e.g., wallet with sufficient balance and no OTP):
{
"data": {
"id": "txn_abc123",
"paymentId": "123e4567-e89b-12d3-a456-426614174000",
"status": "The amount was deposited successfully",
"statusCode": 2,
"require3DS": false,
"metadata": {}
},
"message": "payment proceeded successfully"
}{
"data": {
"id": "txn_abc123",
"paymentId": "123e4567-e89b-12d3-a456-426614174000",
"status": "The amount was deposited successfully",
"statusCode": 2,
"require3DS": false,
"metadata": {}
},
"message": "payment proceeded successfully"
}Response - Requires Action (OTP)
When the wallet requires OTP verification, the response includes a payUrl that the user must be redirected to:
{
"data": {
"id": "txn_abc123",
"paymentId": "123e4567-e89b-12d3-a456-426614174000",
"status": "Pending 3DS Verification",
"statusCode": 12,
"require3DS": true,
"metadata": {
"payUrl": "https://payment-otp.yassir.io/otp/verify?requestId=txn_abc123&phone=213555123456&amount=1500¤cy=DZD&paymentMethod=WALLET_V2"
}
},
"message": "payment proceeded successfully"
}{
"data": {
"id": "txn_abc123",
"paymentId": "123e4567-e89b-12d3-a456-426614174000",
"status": "Pending 3DS Verification",
"statusCode": 12,
"require3DS": true,
"metadata": {
"payUrl": "https://payment-otp.yassir.io/otp/verify?requestId=txn_abc123&phone=213555123456&amount=1500¤cy=DZD&paymentMethod=WALLET_V2"
}
},
"message": "payment proceeded successfully"
}Handling Redirects
require3DS is true, you must redirect the user to the payUrl. Append a returnUrl query parameter so the user is redirected back to your app after completing verification. Example:payUrl + &returnUrl=https://yourapp.com/payment-success?paymentId=...Response - Pre-Authorized
When using captureMethod: "RESERVATION", a successful proceed returns a pre-authorized status. The funds are reserved but not yet captured.
{
"data": {
"id": "txn_abc123",
"paymentId": "123e4567-e89b-12d3-a456-426614174000",
"status": "Pre-authorized",
"statusCode": 13,
"require3DS": false,
"metadata": {}
},
"message": "payment proceeded successfully"
}{
"data": {
"id": "txn_abc123",
"paymentId": "123e4567-e89b-12d3-a456-426614174000",
"status": "Pre-authorized",
"statusCode": 13,
"require3DS": false,
"metadata": {}
},
"message": "payment proceeded successfully"
}Response - Rejected
When the payment is rejected by the provider (e.g., insufficient balance):
{
"data": {
"id": "txn_abc123",
"paymentId": "123e4567-e89b-12d3-a456-426614174000",
"status": "Transaction was rejected",
"statusCode": 3,
"require3DS": false,
"metadata": {}
},
"message": "payment proceeded successfully"
}{
"data": {
"id": "txn_abc123",
"paymentId": "123e4567-e89b-12d3-a456-426614174000",
"status": "Transaction was rejected",
"statusCode": 3,
"require3DS": false,
"metadata": {}
},
"message": "payment proceeded successfully"
}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. |
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.
/payments/intents/:id/checkURL Parameters
idstringrequiredpaymentId to check.Required Headers
AuthorizationstringrequiredBasic base64(client_id:client_secret)x-platformstringrequiredAPIWEBANDROIDIOSx-servicestringrequiredx-client-tokenstringrequiredExample Request
curl -X GET "https://api.payment.yassir.io/payments/intents/123e4567-e89b-12d3-a456-426614174000/check" \
-H "Authorization: Basic $(echo -n 'your_client_id:your_client_secret' | base64)" \
-H "x-platform: API" \
-H "x-service: YOUR_SERVICE" \
-H "x-client-token: user_token_here"curl -X GET "https://api.payment.yassir.io/payments/intents/123e4567-e89b-12d3-a456-426614174000/check" \
-H "Authorization: Basic $(echo -n 'your_client_id:your_client_secret' | base64)" \
-H "x-platform: API" \
-H "x-service: YOUR_SERVICE" \
-H "x-client-token: user_token_here"Response
{
"data": {
"id": "txn_abc123",
"paymentId": "123e4567-e89b-12d3-a456-426614174000",
"status": "The amount was deposited successfully",
"statusCode": 2,
"amount": 1500.00,
"currency": "DZD",
"paymentMethodCode": "WALLET_V2"
},
"message": "payment checked successfully"
}{
"data": {
"id": "txn_abc123",
"paymentId": "123e4567-e89b-12d3-a456-426614174000",
"status": "The amount was deposited successfully",
"statusCode": 2,
"amount": 1500.00,
"currency": "DZD",
"paymentMethodCode": "WALLET_V2"
},
"message": "payment checked 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.
/payments/intents/:id/captureURL Parameters
idstringrequiredpaymentId of the pre-authorized payment.Request Body
amountnumberoptionalRequired Headers
AuthorizationstringrequiredBasic base64(client_id:client_secret)x-platformstringrequiredAPIWEBANDROIDIOSx-servicestringrequiredExample Request
# Capture a partial amount (e.g., reserved 5000, capture 4500)
curl -X POST "https://api.payment.yassir.io/payments/intents/123e4567-e89b-12d3-a456-426614174000/capture" \
-H "Authorization: Basic $(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/payments/intents/123e4567-e89b-12d3-a456-426614174000/capture" \
-H "Authorization: Basic $(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": {
"id": "txn_abc123",
"paymentId": "123e4567-e89b-12d3-a456-426614174000",
"status": "The amount was deposited successfully",
"statusCode": 2
},
"message": "payment captured successfully"
}{
"data": {
"id": "txn_abc123",
"paymentId": "123e4567-e89b-12d3-a456-426614174000",
"status": "The amount was deposited successfully",
"statusCode": 2
},
"message": "payment captured successfully"
}Partial Capture
Release Payment
Releases a pre-authorized payment without capturing any funds. The full reserved amount is returned to the user's wallet.
/payments/intents/:id/releaseURL Parameters
idstringrequiredpaymentId of the pre-authorized payment.Required Headers
AuthorizationstringrequiredBasic base64(client_id:client_secret)x-platformstringrequiredAPIWEBANDROIDIOSx-servicestringrequiredExample Request
curl -X POST "https://api.payment.yassir.io/payments/intents/123e4567-e89b-12d3-a456-426614174000/release" \
-H "Authorization: Basic $(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/payments/intents/123e4567-e89b-12d3-a456-426614174000/release" \
-H "Authorization: Basic $(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": {
"id": "txn_abc123",
"paymentId": "123e4567-e89b-12d3-a456-426614174000",
"status": "Reversed",
"statusCode": 10
},
"message": "payment released successfully"
}{
"data": {
"id": "txn_abc123",
"paymentId": "123e4567-e89b-12d3-a456-426614174000",
"status": "Reversed",
"statusCode": 10
},
"message": "payment released successfully"
}Refund Payment
Refund a completed payment, either fully or partially. Yassir Wallet supports multiple partial refunds on a single payment — each refund reduces the remaining refundable balance.
/payments/:paymentId/refundURL Parameters
paymentIdstringrequiredRequest Body
descriptionstringrequiredamountnumberoptionalreasonstringoptionalRequired Headers
AuthorizationstringrequiredBasic base64(client_id:client_secret)x-platformstringrequiredAPIWEBANDROIDIOSx-servicestringrequiredExample: Full Refund
curl -X POST "https://api.payment.yassir.io/payments/123e4567-e89b-12d3-a456-426614174000/refund" \
-H "Authorization: Basic $(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/payments/123e4567-e89b-12d3-a456-426614174000/refund" \
-H "Authorization: Basic $(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"
}'Example: Partial Refund
curl -X POST "https://api.payment.yassir.io/payments/123e4567-e89b-12d3-a456-426614174000/refund" \
-H "Authorization: Basic $(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/payments/123e4567-e89b-12d3-a456-426614174000/refund" \
-H "Authorization: Basic $(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": {
"id": "refund_xyz789",
"paymentId": "123e4567-e89b-12d3-a456-426614174000",
"amount": 500.00,
"status": "completed",
"reason": "Partial refund for item return"
},
"message": "payment refunded successfully"
}{
"data": {
"id": "refund_xyz789",
"paymentId": "123e4567-e89b-12d3-a456-426614174000",
"amount": 500.00,
"status": "completed",
"reason": "Partial refund for item return"
},
"message": "payment refunded successfully"
}Multiple 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)