Text to Pay-Over-Time
Overview#
The Text to Pay-Over-Time API can be used to send a Text Message (SMS) to the customer's phone in order to complete an online-purchase transaction.
Customers will receive a URL which can be used to checkout with Sunbit for a specific transaction.
Please include representative details such as id, name and email which will enable Sunbit to improve the experience for associates and help them close more transactions.

Text to Pay-Over-Time#
POST https://api-sandbox.sunbit.com/epay/api/v1/epay/send-link#
Important
This is a new version of the Sunbit Text to Pay-Over-Time API and the following update is available: "advisorEmail" attribute in the request body has been replaced with "representativeEmail" in order to be consistent across all APIs and SDKs. Please upgrade to the latest version by 12/31/2022.
Request Headers#
| Attribute | Required | Type | Description | 
|---|---|---|---|
| sunbit-key | yes | text | Provided to you by Sunbit | 
Body#
| Attribute | Required | Type | Description | 
|---|---|---|---|
| phoneNumber | no | text | The customer's phone number. this field is required when sendSMS is true | 
| amount | yes | number | The purchase amount | 
| customerDetails | no | CustomerDetails | Customer's details | 
| location | yes | text | Your location ID as provided by Sunbit | 
| transactionId | yes | text | An external transaction identifier (referral) sent by the integrator for Pre-Qualification or Text to Pay-Over-Time and used to match the Webhook to the request. | 
| representativeFirstName | no | text | First Name of the representative/associate. | 
| representativeLastName | no | text | Last Name of the representative/associate. | 
| representativeEmail | no | text | Email address of the representative/associate. | 
| sendSMS | no | boolean | False if Sunbit should not send the link to the customer. Default to True | 
| departmentId | no | text | This parameter create a differentiation of offers within a certain merchant. The DepartmentID should be provided to you by Sunbit. Please refrain from sending data in this field which was not provided for you. | 
| sourcePlatform | no | text | The originating platform on whose behalf the API request is being made, if different from the alliance. | 
| redirectUrl | no | text | A url destination which the user will fallback after completing / aborting the application. | 
CustomerDetails#
| Attribute | Required | Type | Description | 
|---|---|---|---|
| firstName | no | text | Customer's first name | 
| lastName | no | text | Customer's last name | 
| no | text | Customer's email address | |
| phone | no | text | Customer's phone number | 
| dateOfBirth | no | text | Customer's date of birth (format: yyyy-MM-dd) | 
| addressDetails | no | AddressDetails | Customer's address details | 
AddressDetails#
| Attribute | Required | Type | Description | 
|---|---|---|---|
| address | no | text | Customer's address | 
| city | no | text | Customer's city | 
| state | no | text | Customer's state | 
| zipcode | no | text | Customer's zipcode | 
JSON example
{  "phoneNumber": "9302006381",  "amount": 120,  "customerDetails": {    "firstName": "Kelly",    "lastName": "Moore",    "email": "someone@nothing.com",    "phone": "9302006381",    "dateOfBirth": "1965-05-15",    "addressDetails": {      "address": "55 King St.",      "city": "Los Angeles",      "state": "CA",      "zipcode": "55555"    }  },  "location": "test",  "roNumber": "1234",  "transactionId": "9999",  "representativeName": "Jason",  "representativeEmail": "jason@email.com"}Response#
The response is a JSON with a URL link:
| Attribute | Type | Description | 
|---|---|---|
| shortToken | text | Short-Token of Pay-overtime | 
| longToken | text | Long-Token of Pay-overtime | 
| retailerId | text | retailer id - Only if present | 
| url | text | URL for Pay-overtime | 
Example#
{  "shortToken": "<short-token>",  "longToken":  "<long-token>",  "retailerId": "<retailer-id>",  "url":"<sunbit-pay-overtime-link>"}Example#
## Validation Call Example:## Request:curl --request POST \  --url https://api-sandbox.sunbit.com/epay/api/v1/epay/send-link \  --header 'Content-Type: application/json' \  --header 'accept: */*' \  --header 'sunbit-key: YOUR_KEY' \  --data '{ "phoneNumber": "9302006381", "amount": 120, "customerDetails": { "firstName": "Kelly", "lastName": "Moore", "email": "someone@nothing.com", "phone": "9302006381", "dateOfBirth": "1965-05-15", "addressDetails": { "address": "55 King St.", "city": "Los Angeles", "state": "CA", "zipcode": "55555" } },"location": "test", "roNumber": "1234", "transactionId": "9999", "representativeName": "Jason",  "representativeEmail": "jason@email.com", "sendSMS": true}'Errors#
| Error Code | Message | Description | 
|---|---|---|
| 403 | Provided alliance is not allowed | sunbit-key provided is not associated with the retailer | 
| 404 | Location does not exist | Location provided is not associated with the retailer | 
| 422 | Invalid phone number | Invalid US phone number | 
| 422 | Email address is not valid | Invalid representative email address | 
| 500 | Internal Server Error | Missing location attribute or something went wrong on Sunbit's side |