{"openapi":"3.0.3","info":{"title":"ShaBaasPay Public API","version":"1.0.0","description":"Describes public REST endpoints for authorization, payment agreements, payment initiations,\nrefunds, webhooks, and PayID collection APIs.\n"},"servers":[{"url":"https://dev-api.shabaas.com","description":"Staging"},{"url":"https://api.shabaas.com","description":"Production"}],"tags":[{"name":"Payment Agreement","x-displayName":"Payment Agreement","description":"Create, retrieve, amend, resend, and cancel PayTo payment agreements."}],"x-tagGroups":[{"name":"SHABAASPAY PUBLIC API","tags":["API Keys","Payment Agreement","Payment Initiation","Checkout","B2B Collections","Webhooks"]},{"name":"Internal","tags":["Clients"]}],"security":[{"BearerAuth":[]}],"paths":{"/api/public/payment_agreement/resend":{"patch":{"tags":["Payment Agreement"],"summary":"Resend Agreement","description":"Re-issue an agreement authorization request using agreement id or phone number.\n\n### Error Codes\n| Code | Status | Reason | What to do |\n| ---- | ------ | ------ | ---------- |\n| GN-0000 | 422 | Missing or empty `payment_agreement` (Rails) | Send JSON `{\"payment_agreement\":{\"id\":\"...\"}}` or `{\"payment_agreement\":{\"phone_number\":\"...\"}}`. |\n| PA-0001 | 422 | Maximum resend attempts in the rolling window | Wait (e.g. 24h) before calling resend again. |\n| GN-0000 | 404 | No user for `phone_number` (phone path) | Verify `phone_number` format and user exists. |\n| PAM_SB_PAG_NOT_FOUND_ERROR | 404 | Agreement `id` not found or not owned by merchant | Verify `id` and merchant. |\n| (Monoova `PAM_*`) | 400 | Upstream rejected payer/payee payload on resend | Fix payer bank/PayID data; see create-agreement payer fields. |\n| PAM_UNEXPECTED_ERROR | 500 | Unexpected resend processing error | Retry later; contact support if repeated. |\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["payment_agreement"],"properties":{"payment_agreement":{"$ref":"#/components/schemas/ResendPaymentAgreementRequest"}}},"examples":{"by_id":{"value":{"payment_agreement":{"id":"3652PA20260408123221550"}}},"by_phone_number":{"value":{"payment_agreement":{"phone_number":"+61-422020901"}}}}}}},"responses":{"200":{"description":"Agreement resend request submitted successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessPaymentAgreementResponse"},"examples":{"resent":{"summary":"Resend request accepted","value":{"message":"Payment Agreement resent successfully, Please authorized payment agreement from your banking app.","data":{"payment_agreement_id":"3652PA20260428124500999","status":"initiated","end_date":"2026-12-31","created_at":"2026-04-28T12:45:00.000Z","maximum_amount":"500.00","extented_status":"500-WEEK-10-initiated"}}}}}}},"404":{"description":"User agreement id not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"user_not_found":{"value":{"message":"User not found","error_code":"GN-0000","data":{"response_time":"2026-04-10T12:00:00.000Z"}}},"agreement_not_found":{"value":{"message":"PaymentAgreement not found for PaymentAgreementUID","error_code":"PAM_SB_PAG_NOT_FOUND_ERROR","data":{"response_time":"2026-04-10T12:00:00.000Z"}}}}}}},"422":{"description":"Missing JSON wrapper, or resend rate limit (`ERRORCODE-resend_max_reached` → **PA-0001** in the API).\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"missing_payment_agreement_param":{"summary":"Body without `payment_agreement` (or empty)","value":{"message":"param is missing or the value is empty: payment_agreement","error_code":"GN-0000","data":{"response_time":"2026-05-04T11:20:29.982Z"}}},"resend_limit":{"summary":"Too many resend calls in the window","value":{"message":"Maximum limit has been reached. Please retry after 24 hours","error_code":"PA-0001","data":{"response_time":"2026-04-10T12:00:00.000Z"}}}}}}}}}}},"components":{"schemas":{"ResendPaymentAgreementRequest":{"type":"object","description":"Provide either agreement `id` or `phone_number`.","oneOf":[{"required":["id"]},{"required":["phone_number"]}],"properties":{"id":{"type":"string"},"phone_number":{"type":"string"}}},"SuccessPaymentAgreementResponse":{"type":"object","description":"Standard success envelope for payment agreement APIs.","properties":{"message":{"type":"string","description":"Message for the request response.","example":"Payment Agreement created successfully, Please authorized payment agreement from your banking app."},"data":{"$ref":"#/components/schemas/PaymentAgreement"}}},"PaymentAgreement":{"type":"object","description":"Payment agreement object returned by create/get agreement APIs.","properties":{"payment_agreement_id":{"type":"string","description":"Unique agreement identifier. Use this value to retrieve, amend, resend, or cancel the agreement.","example":"3652PA20260428120000123"},"status":{"type":"string","description":"Current agreement state in the processing lifecycle.","example":"initiated"},"end_date":{"type":"string","format":"date","description":"Agreement end date when set; null/omitted when open-ended.","example":"2026-12-31"},"created_at":{"type":"string","format":"date-time","description":"Agreement creation timestamp in ISO8601 format.","example":"2026-04-28T12:00:00.000Z"},"maximum_amount":{"type":"string","description":"Maximum debit amount allowed per agreement.","example":"500.00"},"maximum_overall_allowed_amount":{"type":"string","description":"Overall collection cap for the agreement when set (cumulative amount across all payment initiations).\n","example":"2000.00"},"extented_status":{"type":"string","description":"Compact composite status string used by existing clients.","example":"500-WEEK-10-initiated"},"message":{"type":"string","description":"Present when agreement has a failure message from scheme","example":"Payee account cannot receive NPP Payments"},"failure_code":{"type":"string","description":"Provider/business failure code when the agreement fails.","example":"M100"}}},"ErrorResponse":{"type":"object","required":["message","error_code","data"],"properties":{"message":{"type":"string","example":"Payee account cannot receive NPP Payments"},"error_code":{"type":"string","example":"MOV_NPP_PAYMENT_NOT_SUPPORTED"},"data":{"type":"object","additionalProperties":true,"example":{"response_time":"2026-04-08T12:28:26.759Z"}}}}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer token returned by `/api/public/authorization`."}}}}