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

  1. Go to the Merchant Settings and select Security Keys.
  2. 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


bash
Copy code
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": { "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

json
Copy 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

CodeMessage
200Transaction was declined by processor.
201Do not honor.
202Insufficient funds.
203Over limit.
204Transaction not allowed.
220Incorrect payment information.
221No such card issuer.
222No card number on file with issuer.
223Expired card.
224Invalid expiration date.
225Invalid card security code.
226Invalid PIN.
240Call issuer for further information.
250Pick up card.
251Lost card.
252Stolen card.
253Fraudulent card.
300Transaction was rejected by gateway.
400Transaction error returned by processor.
410Invalid merchant configuration.
411Merchant account is inactive.
420Communication error.
421Communication error with issuer.
430Duplicate transaction at processor.
440Processor format error.
441Invalid transaction information.
460Processor feature not available.
461Unsupported card type.
900Bad request, form validation error.
901Required Card Information.
902VaultId or PaymentToken is required.
903Merchant with id: ClientId not found.
904Apply discount option is disabled for this merchant.
905Card number is required.
906Vault with id: VaultId not found.
907Mismatch in the client's credit rate configuration.
908Debit card payments not accepted.
909Unsupported card type.
999Communication error.


Validation Rules


FieldValidationExample
card.numberRegExp: /\d{6}[*\.]+\d{4}/g411111***1111
Required if vaultId is emptyUse card number if vaultId is not present411111***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

Let us know how can we improve this article!

Select at least one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article