Skip Cash Integration Manual
Skip Cash Integration Manual
1
About this guide ................................................................................................................................... 3
Audience and purpose ..................................................................................................................... 3
Web Site Requirements ................................................................................................................... 3
Customer support ............................................................................................................................ 3
1. Process overview.............................................................................................................................. 4
2. Card Checkout API ............................................................................................................................ 5
2.1 Create an online payment .......................................................................................................... 5
2.1.1 The Authorization header ................................................................................................... 7
2.1.2 Examples of request and responses ................................................................................. 10
2.2 Load the detail of the Online payment .................................................................................... 12
2.2.1 The Authorization header ................................................................................................. 12
2.2.2 Examples of request and responses ................................................................................. 12
3. Card Checkout Configuration ......................................................................................................... 14
3.1 Online Payments page ............................................................................................................. 14
3.2 Sandbox -> Credentials page .................................................................................................... 15
3.3 Sandbox -> API Calls page ........................................................................................................ 15
3.4 Sandbox -> Webhook Events page........................................................................................... 16
3.5 Sandbox -> Webhooks Simulator page .................................................................................... 16
3.6 Production -> Credentials page................................................................................................ 17
4. Webhooks ...................................................................................................................................... 18
4.1 WebHooks URL configuration .................................................................................................. 18
4.2 Implementing WebHooks ........................................................................................................ 19
4.2.1 The Authorization header ................................................................................................. 20
4.2.2 Examples of request and responses ................................................................................. 22
4.3 Debugging WebHooks .............................................................................................................. 22
4.4 Testing WebHooks ................................................................................................................... 23
5. The recommended integration process ......................................................................................... 24
5.1 Backend .................................................................................................................................... 24
5.2 Frontend ................................................................................................................................... 25
6. Going to Production ....................................................................................................................... 26
2
ABOUT THIS GUIDE
This guide is written for Merchants who want to customize and control their own customer
checkout experience. Using the Card Checkout API requires moderate programming skills.
The IT infrastructure must be Public Key Infrastructure (PKI) enabled to use SSL-based form
POST submissions. (secure transfer over https)
The IT infrastructure must be capable of digitally signing data prior to submission to SkipCash
API. (as described in section 2.1.1 and 2.2.1)
Customer support
For support information about any SkipCash service, kindly contact the Support Center:
support@skipcash.com
3
1. PROCESS OVERVIEW
If the Merchants want to implement the Online payments, they supposed to have:
4
2. CARD CHECKOUT API
The private key is used to authenticate both of these endpoints. It consists of:
key ID
key secret
The key ID is a public identifier of the private key. SkipCash uses it for the identification of the
key and the Merchant. Every Merchant has an additional public identifier called Client ID.
The key secret is used to calculate the signature from the request body in a create a payment
endpoint, and Client ID is validated in getting the detail of a payment request.
Please note that the key secret must be stored securely on the Merchant server and never send
to the frontend (either browser or mobile app). This means, that when creating a new online
payment, it has to be done from the backend of the Merchant server.
If the private key is compromised, the 3rd party can create online payments on behalf of the
Merchant.
POST /api/v1/payments
{
"uid": "string",
"keyId": "uuid",
"amount": "string",
"firstName": "string",
"lastName": "string",
"phone": "string",
5
"email": "string",
"street": "string",
"city": "string",
"state": "string",
"country": "string",
"postalCode": "string",
"transactionId": "string",
"custom1": "string"
}
uid – A random string, usually generating a new UUID is fine. Helps to randomize calculated
signature.
keyId – the ID of the generated private key
amount – the transaction amount. It is a string. The number must be separated by a dot and hasa
max of 2 decimal places. Examples of valid values: „10“, „10.2“, „10.24“. Example of invalid
values: „.10“,„10.“, „10,1“, „10.123“.
firstName – the shopper first name
lastName – the shopper last name
phone – the shopper phone number (with or without country code)
email – the shopper email
street, city, state, country, postalCode – the shopper address information
transactionId – the merchant internal order ID. Useful when processing webhooks from
SkipCash.
custom1 – the Merchant custom value, can be used in any way by the merchant
keyId M uuid
6
street M Max length 60
https://developer.cybersource.com/library/documentation/sbc/quickref/countries_alpha_list.pdf
The response fields are the same as in the load detail request described in section 2.2.
The signature should be calculated using the key ID and key secret in the authorization header.
The process described as following:
1. Combine all not empty request fields into key=value comma-separated values.
The list of all keys: Uid, KeyId, Amount, FirstName, LastName, Phone, Email, Street, City,
State, Country, PostalCode, TransactionId, Custom1
Note: The order of fields is important!
2. Encrypt using the algorithm HMACSHA256
3. Convert to base 64 format
4. Send the result in the Authorization header with the request body
{
"amount": "11",
"keyId": ",
7
"uid": "01916FC2-411B-4465-A3A8-F7699AD2F757",
"firstName": "Peter",
"lastName": "Green",
"email" : "green@test.sk"
}
Client ID:
Key ID:
Key Secret:
Combining all the request fields into key=value line separated by comma:
Uid=01916FC2-411B-4465-A3A8-F7699AD2F757,KeyId=
,Amount=11,FirstName=Peter,LastName=Green,Email=green@test.sk
8
}
9
2.1.2 Examples of request and responses
The Merchant configuration used in these example requests is the same as in the previous
section.
POST /api/v1/payments
Authorization: rKE6vUxneWOflG/Tx2FP9dSTm+QVnn0kCWu7njOZidk=
{
"amount": "15.25",
"keyId": " ",
"uid": "1A7447ED-BE99-4385-A814-91292CFB8003",
"firstName": "John",
"lastName": "Doe",
"email" : "john-doe@test.sk"
}
Example response:
{
"resultObj": {
"id": "f0f18db8-ae45-4be2-a155-9f7f0714874b",
"statusId": 0,
"created": "2021-06-30T13:11:01Z",
"payUrl": "https://skipcashtest.azurewebsites.net/pay/f0f18db8-ae45-4be2-a155-
9f7f0714874b",
"amount": 15.25,
"currency": "QAR",
"transactionId": null,
"custom1": null,
"visaId": null,
"status": "new"
},
"returnCode": 200,
"errorCode": 0,
"errorMessage": null,
"error": null,
"validationErrors": null,
"hasError": false,
"hasValidationError": false
}
10
Example 2 – Request with the optional fields:
POST /api/v1/payments
Authorization: yRXjFyoyh8kLSqdgb/UerWFCBp5cSBTGmbdxpParEzo=
{
"amount": "19",
"keyId": " ",
"uid": "9FE2928B-0A1C-47CC-AF60-A9B14134B510",
"firstName": "John",
"lastName": "Doe",
"email" : "john-doe@test.sk",
"phone" : "+97400000001",
"street": "Al Samriya St 10",
"country": "QA",
"city":"Doha",
"transactionId":"custom-internal-id",
"custom1":"test"
}
Example response:
{
"resultObj": {
"id": "770bd18b-a505-468b-8de1-ac7f9555dc79",
"statusId": 0,
"created": "2021-06-30T13:33:52Z",
"payUrl": "https://skipcashtest.azurewebsites.net/pay/770bd18b-a505-468b-8de1-
ac7f9555dc79",
"amount": 19,
"currency": "QAR",
"transactionId": "custom-internal-id",
"custom1": "test",
"visaId": null,
"status": "new"
},
"returnCode": 200,
"errorCode": 0,
"errorMessage": null,
"error": null,
"validationErrors": null,
"hasError": false,
"hasValidationError": false
}
11
2.2 Load the detail of the Online payment
REST endpoint for loading the detail of the Online payment:
GET /api/v1/payments/{id}
Response fields:
statusId – the payment status, 0 – new, 1 – pending, 2 – paid, 3 – canceled, 4 – failed, 5 – rejected,
6 – refunded, 7 – pending refund, 8 – refund failed
visaId – the internal CyberSource payment ID. Record this ID into your database for reconciliation
purposes.
status – the text representation of statusId
GET /api/v1/payments/770bd18b-a505-468b-8de1-ac7f9555dc79
Example response:
{
"resultObj": {
"id": "770bd18b-a505-468b-8de1-ac7f9555dc79",
"statusId": 0,
"created": "2021-06-30T13:33:52Z",
"payUrl": "https://skipcashtest.azurewebsites.net/pay/770bd18b-a505-468b-8de1-
ac7f9555dc79",
"amount": 19.000,
12
"currency": "QAR",
"transactionId": "custom-internal-id",
"custom1": "test",
"visaId": null,
"status": "new"
},
"returnCode": 200,
"errorCode": 0,
"errorMessage": null,
"error": null,
"validationErrors": null,
"hasError": false,
"hasValidationError": false
}
13
3. CARD CHECKOUT CONFIGURATION
14
3.2 Sandbox -> Credentials page
When the return URL is configured, the payment flow changes accordingly:
Once the payment is finished, instead of automatically closing the browser window, the
SkipCash is redirecting back to the respective configured return URL.
Additional parameters like id, statusId, and status of the processed transaction are added. It
is highly important to call the SkipCash REST endpoint for the transaction detail and verify the status
result of the processed transaction. This is for security reasons, since URL parameters can be
altered. can be altered by the shopper.
It is highly important to call the SkipCash REST endpoint for the transaction detail after and
verify the status result of the processed transaction
15
Create a private key:
1. Click on the button „Generate a New Secret Key“
2. The new record is created and shown in the table
3. Store the key ID and key secret in your Merchant configuration
Usually, one private key per Merchant is sufficient. You can periodically replace your old keys to
increase security:
16
3.2 Sandbox -> API Calls page
The table contains the list of all calls from the Merchant server to the SkipCash server. Useful
for debugging and testing the public endpoints. The details of each request are in the separate modal
window after clicking on the link „Detail“.
The table contains the list of all webhook calls from the SkipCash server to the Merchant
server. Useful for debugging and testing the webhook processing.
event type – specify the event you want to test (Success, Failure, Cancel)
17
How to set up webhooks is described in detail in section 4.
The equal page as in Sanbox page (3.2 Sandbox -> Credentials page), just for the Production
environment.
18
4. WEBHOOKS
The SkipCash server will notify the Merchant server about the payment status when the
Webhook is properly configured within the Merchant Portal.
By using Webhooks it is possible to notify the Merchant page when the shopper closes the
browser window right after the payment is completed, hence the Merchant is notified and able to
finish the respective payment from the background.
Kindly note, that for the one single Merchant order, multiple webhook calls can be triggered
from the SkipCash.
The shopper clicks on the Pay button and immediately closes the browser window. This
action may be repeated several times. Every time a new transaction will be created for the
same merchant order. All created unprocessed transactions will be automatically canceled
within 1 hour. The merchant will be notified of the cancelation event multiple times.
The Shopper clicks on the Pay button, confirms the payment, but the payment fails. The
Shopper will close the browser window and try the same action again. For each failure, the
Merchant will be called with a Failure event. When failure happens, SkipCash will not finish
the existing original payment to preserve the payment link. Instead, an exact transaction
copy with a new generated ID will be created and stored with status Fail. This means, that
the payment ID in the webhook call will be different and unknown to the Merchant (if the
Merchant stores our original internal ID). In this case, the best is to ignore this webhook call.
To use the webhooks system, the Webhooks URL must be configured in Sandbox - Credentials
first:
1. Go to Sandbox Page
2. Type URL for webhook processing. The SkipCash will call this URL for every transaction status
change.
3. Click on „Save“
4. SkipCash will send webhooks to the Merchant server.
19
4.2 Implementing WebHooks
When the transaction finishes, SkipCash will call the Merchant server:
20
4.2.1 The Authorization header
The signature must be calculated using the webhook key in the authorization header.
This is the same process as the Online payment creation:
1. Combine all not empty request fields into key=value comma-separated values.
The list of all keys: PaymentId, Amount, StatusId, TransactionId, Custom1, VisaId
Note: The order of fields is important!
2. Encrypt using the algorithm HMACSHA256
3. Convert to base 64 format
4. Send the result in the Authorization header with the request body
WebHook Key:
Combine not empty request fields into key=value text separated by comma
PaymentId=c6409932-9c11-461b-b508-
cb094d7db4f6,Amount=11.00,StatusId=2,VisaId=6251217598876165804006
21
Example code in c#:
public static string CalculateWebHookSignature(WebHookRequest request, string secretKey)
{
var data = BuildWebHookData(request);
UTF8Encoding encoding = new UTF8Encoding();
byte[] keyByte = encoding.GetBytes(secretKey);
}
private static string BuildWebHookData(WebHookRequest request)
{
var list = new List<string>();
AppendData(list, "PaymentId", request.PaymentId.ToString());
AppendData(list, "Amount", request.Amount);
AppendData(list, "StatusId", request.StatusId.ToString());
AppendData(list, "TransactionId", request.TransactionId);
AppendData(list, "Custom1", request.Custom1);
AppendData(list, "VisaId", request.VisaId);
return string.Join(',', list);
}
{
list.Add($"{name}={value}");
}
}
22
4.2.2 Examples of request and responses
The Merchant configuration (WebHook Key) used in these example requests is the same as
in the previous section 4.2.1.
Example response:
It will depend on the Merchant's response. SkipCash will look only for HTTP status. If
the status is 200, the webhook call is counted as a success. Otherwise as a failure, and
SkipCash will call the Merchant with the same request later.
Every call from the SkipCash server to the Merchant server is logged. You can review the full
request and response logged in Webhook Events on Sandbox Page.
SkipCash will try to call the Merchant server 3 times in total. The Merchant must return HTTP
status 200. Otherwise, it is counted as a failure, and SkipCash will try to call the endpoint later (for
a total of 3 times).
The timeout for the request is 10 seconds, after this time the request is also counted as a failure.
The retry times are as following:
1 hour later
1 day later
23
4.4 Testing WebHooks
The Webhooks can be tested on the Webhooks Simulator page in Sandbox. This is possible
only when the WebHooks URL is configured.
Payment ID – this is our internal ID. Useful when you have already created some
unfinished transactions and want to test the end processing.
After clicking on the Send button, the WebHooks URL endpoint is called with specified data.
The result is logged in the Webhook Events tab.
5. Once everything is working as expected, you can implement events with the wrong keys.
You need to validate the authorization header, otherwise, you can‘t be sure if SkipCash
sends the webhook.
6. Test the rest of event types: Success payment signed with the wrong key, Failure payment
signed with the wrong key, Cancel event signed with the wrong key.
24
5. THE RECOMMENDED INTEGRATION PROCESS
5.1 Backend
1. Setup online payments in the Merchant portal as described in 3.1 and 3.2.
a. Enable Online payments for the TEST environment by clicking on ‚Enable Sandbox‘
b. Create one private key in Sandbox
SkipCashKeyId – the private key ID, from Sandbox - > Credentials page, column Id
SkipCashKeySecret – the private key Secret, from Sandbox -> Credentials page, column
Secret Key
SkipCashWebhookKey – the private webhook key, from Sandbox -> Credentials page
5. Create and test the endpoint for processing webhooks from SkipCash:
Described process in section 4.
25
5.2 Frontend
d. For Apple Pay, if a WebView is used, some additional configuration maybe required
by the WebView library/package. This is dependent on the WebView library.
f. When the Shopper pays, the browser window is closed by the script automatically.
g. When the browser window is closed, the transaction finished, either successfully or
not. Or was manually closed by the Shopper.
h. Create a call to your backend server to check the final status of the transaction.
i. If the transaction was not paid, there is nothing to do. The shopper can pick another
form of payment or try again with SkipCash.
26
6. GOING TO PRODUCTION
When everything is working as expected in the TEST environment, you can proceed to go live
into Production. To do so, you should change your backend configuration:
1. Setup online payments in the Merchant portal as described in 3.1 and 3.6.
a. Enable online payments for the PRODUCTION environment by clicking on ‚Enable
Production‘
b. Create one private key in Production
SkipCashKeyId – the private key ID, from Production - > Credentials page, column Id
SkipCashKeySecret – the private key Secret, from Production -> Credentials page, column
Secret Key
SkipCashWebhookKey – the private webhook key, from Production -> Credentials page
27