> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rebellapp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# my.signContract

> Trigger the contract signing flow.

Invoke the contract signing UI for recurring payments or agreements.

## Parameters

| Property | Type     | Required | Description                         |
| -------- | -------- | -------- | ----------------------------------- |
| signStr  | String   | Yes      | Signed contract string from backend |
| success  | Function | No       | Callback with sign result           |
| fail     | Function | No       | Callback on failure                 |
| complete | Function | No       | Callback that always executes       |

## Success Callback

| Property  | Type   | Description                                                                             |
| --------- | ------ | --------------------------------------------------------------------------------------- |
| authState | String | Authorization state generated by the Mini Program server (max 256 characters)           |
| authCode  | String | Authorization code for obtaining the agreement payment access token (max 32 characters) |

## Fail Callback

| Property   | Type   | Description                      |
| ---------- | ------ | -------------------------------- |
| error      | String | Error code                       |
| errMessage | String | Human-readable error description |

## Error Codes

| Code   | Meaning                                      |
| ------ | -------------------------------------------- |
| `6001` | User cancelled the signing process           |
| `6002` | Network error during signing                 |
| `7001` | Outcome unknown — signing may have succeeded |
| `7002` | Signing failed                               |

## Code Example

```javascript theme={null}
my.signContract({
  signStr: signStrFromBackend,
  success: (res) => {
    console.log('Auth code:', res.authCode);
    // Exchange authCode server-side via applyToken
  },
  fail: (err) => {
    if (err.error === '6001') {
      console.log('User cancelled');
    } else {
      console.error('Signing failed:', err.errMessage);
    }
  }
});
```
