POST /v1/authorizations/prepare
Prepares the contract information for agreement payment authorization, for subscription scenarios (for example monthly, quarterly or yearly charges). Returns an authUrl to pass as signStr to my.signContract in the Mini Program.
Request Parameters
Distinguishes the merchant’s different businesses. When the same merchant supports agreement payments for several businesses, each business can use a different
referenceClientId for authorization.Max length: 128 charactersJSON object containing contract details.Max length: 4096 charactersExample:
"{\"contractTitle\":\"agreement\",\"contractDesc\":\"agreement payment description.\",\"agreedAmount\":{\"currency\":\"EUR\",\"value\":\"1000\"},\"startTime\":\"2025-01-01\",\"contractStatusNotifyUrl\":\"https://merchant.example.com/contractStatusNotify\"}"Response Parameters
Authorization URL to pass as
signStr to my.signContract in the Mini Program. Returned when result.resultStatus is S.Max length: 256 charactersResult Codes
Agreement Signing Flow
1
User starts signing
The user opens the Mini Program and chooses to sign the agreement. The Mini Program asks the merchant backend for the authorization URL.
2
Reuse or prepare the authUrl
If the backend already has an
authUrl for this content, return it directly: the URL is not tied to a user and stays valid while the content is unchanged. Otherwise (or if the content changed) call /v1/authorizations/prepare, then save or update the authUrl.3
Open the signing page
The backend returns the
authUrl to the Mini Program, which calls my.signContract with it as signStr. The Rebell app shows the agreement to the user.4
User confirms
After the user confirms, the Rebell app returns an
authCode to the Mini Program, which passes it to the merchant backend.5
Exchange the authCode
The backend calls applyToken to get the
accessToken and stores it as the user’s agreement payment contract, then returns the signing result to the Mini Program.