API Integration
Modified on Thu, 26 Sep, 2024 at 6:38 PM
Strictly's public API provides a set of endpoints that can be accessed with proper authentication. Below are the steps to integrate with the API.
Step 1: Obtain Your Security Credentials
- Go to the Merchant Settings and select Security Keys.
- You can create and view access keys on this page, specifying the user authorized to use the API. These keys are denoted as
source: API
.
Step 2: Call the API
For each API call, you will need the following:
- Security Key
- Username
- Password associated with the key
Important: API calls should be made from a server-side application as they involve sensitive information. Include the following headers in your request:
headers: {
"authorization": "Basic {base64_encode(username:password)}",
"key-hash": "your-security-key"
}
Authorization: The Basic Auth string is composed of the username
and password
encoded in Base64.
key-hash: The security key from your Merchant Settings.
API Request Example
Payment with Card
curl --location \
--request POST 'https://api.paywithzero.net/v1/public/payment/charge' \
--header 'Content-Type: application/json' \
--header 'key-hash: YJU56X2NKLVBFLHGEA7J' \
--header 'Authorization: Basic amxib3JyZXJvQGdtYWlsLmNvbToxcWF6eHN3Mg==' \
--data-raw '{
"amount": 5,
"contact": {
"email": "demo@zerosurcharging.com",
"phone": "5555555555"
},
"billingAddress": {
"address": "demo",
"city": "demo",
"country": "US",
"state": "Alaska",
"zipCode": "10400"
},
"shippingAddress": {},
"order": {
"amount": 2,
"shipping": 0,
"tax": 0,
"poNumber": "65614",
"discount": 0
},
"capture": true,
"card": {
"name": "Demo Card",
"paymentToken": "00000000-000000-000000-000000000000",
"number": "411111******1111"
}
}'
paymentToken: This will be generated by ZeroGateway.js and is usable only once.
Payment with Customer Vault
bashCopy codecurl --location \
--request POST 'https://api.paywithzero.net/v1/public/payment/charge' \
--header 'Content-Type: application/json' \
--header 'key-hash: YJU56X2NKLVBFLHGEA7J' \
--header 'Authorization: Basic amxib3JyZXJvQGdtYWlsLmNvbToxcWF6eHN3Mg==' \
--data-raw '{
"amount": 5,
"contact": {
"email": "demo@zerosurcharging.com",
"phone": "5555555555"
},
"billingAddress": {
"address": "demo",
"city": "demo",
"country": "US",
"state": "Alaska",
"zipCode": "10400"
},
"shippingAddress": {},
"order": {
"amount": 2,
"shipping": 0,
"tax": 0,
"poNumber": "65614",
"discount": 0
},
"capture": true,
"card": {
"vaultId": "6037d45411ccca001c4e4287"
}
}'
Response Samples
Successful Response
{
"data": {
"id": "62264b0b15b2da2e2aa5c0d0",
"object": "charge",
"type": "sale",
"amount": 5,
"baseAmount": 5,
"surcharge": 0,
"captured": true,
"transactionId": "7040635314",
"error": false,
"createdAt": "2022-03-07T18:12:27.512Z",
"transactionAt": "2022-03-07T18:12:27.512Z",
"settled": false,
"userAgent": "curl/7.68.0",
"device": "api",
"paymentId": "62264b5f15b2da2e2aa5c0d2",
"createdBy": "demo@zerosurcharging.com",
"updatedBy": "demo@zerosurcharging.com"
}
}
Error Response
jsonCopy code{
"statusCode": 400,
"timestamp": "2022-04-11T22:54:13.822Z",
"path": "/v1/public/payment/charge",
"response": {
"code": "300",
"text": "Transaction was rejected by gateway."
},
"message": "Http Exception"
}
Error Codes and Messages
Code | Message |
---|---|
200 | Transaction was declined by processor. |
201 | Do not honor. |
202 | Insufficient funds. |
203 | Over limit. |
204 | Transaction not allowed. |
220 | Incorrect payment information. |
221 | No such card issuer. |
222 | No card number on file with issuer. |
223 | Expired card. |
224 | Invalid expiration date. |
225 | Invalid card security code. |
226 | Invalid PIN. |
240 | Call issuer for further information. |
250 | Pick up card. |
251 | Lost card. |
252 | Stolen card. |
253 | Fraudulent card. |
300 | Transaction was rejected by gateway. |
400 | Transaction error returned by processor. |
410 | Invalid merchant configuration. |
411 | Merchant account is inactive. |
420 | Communication error. |
421 | Communication error with issuer. |
430 | Duplicate transaction at processor. |
440 | Processor format error. |
441 | Invalid transaction information. |
460 | Processor feature not available. |
461 | Unsupported card type. |
900 | Bad request, form validation error. |
901 | Required Card Information. |
902 | VaultId or PaymentToken is required. |
903 | Merchant with id: ClientId not found. |
904 | Apply discount option is disabled for this merchant. |
905 | Card number is required. |
906 | Vault with id: VaultId not found. |
907 | Mismatch in the client's credit rate configuration. |
908 | Debit card payments not accepted. |
909 | Unsupported card type. |
999 | Communication error. |
Validation Rules
Field | Validation | Example |
---|---|---|
card.number | RegExp: /\d{6}[*\.]+\d{4}/g | 411111***1111 |
Required if vaultId is empty | Use card number if vaultId is not present | 411111***1111 |
Use the above guidelines to integrate with the Strictly API efficiently and handle responses properly.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article