POST /v2/authorizations/prepare
The prepare endpoint is used to set up contract information for agreement payment scenarios. It returns an authorization URL that the user visits to sign the payment agreement.
Use Case
Use this endpoint when implementing subscription or recurring payment flows:- User wants to set up automatic payments
- You call
prepareto create the contract terms - User is redirected to the authorization URL
- User reviews and signs the agreement in the Rebell app
- You receive an
authCodevia callback - Exchange the
authCodefor anaccessTokenusing applyToken
Request Parameters
Identifier to distinguish merchant businesses.Max length: 16 characters
Authorization scope. Use
AGREEMENT_PAY for agreement payment scenarios.Max length: 16 charactersJSON string containing additional contract configuration.Max length: 4096 characters
Response Parameters
Standard result object with
resultCode, resultStatus, resultMessageAuthorization URL for the user to sign the contract. Pass this URL to
my.call("signContract") JSAPI or redirect the user to it.Max length: 256 charactersExample Request
Example Response
Result Codes
| resultStatus | resultCode | Description | Action |
|---|---|---|---|
S | SUCCESS | Contract prepared successfully | Save authUrl for user redirection |
F | PARAM_ILLEGAL | Invalid parameters | Check request parameters |
F | INVALID_AUTH_CLIENT | Invalid auth client ID | Verify your referenceClientId |
F | INVALID_AUTH_CLIENT_STATUS | Auth client status invalid | Contact support |
Implementation Example
Next Steps
After the user completes authorization at theauthUrl, you’ll receive an authCode via your callback. Use it with:
Apply Token
Exchange the authorization code for an access token