PayBolt API Integration
PayBolt Integration

For Developers

  1. 1.
    Embed the Payment Button
To get started, add the following 'sample code' to your checkout page. For details of each parameter, look at the 'button parameters' table after the sample code.
Sample Code
1
<form action=" https://api.pboltdev.com/pay" method="post">
2
<!-- For actual LIVE account, use https://api.paybolt.com/pay -->
3
<input type="hidden" name="version" value="1" />
4
<input type="hidden" name="action" value="capture" />
5
<input type="hidden" name="merchant_id" value="0001283733" />
6
<input type="hidden" name="merchant_reference_id" value="" />
7
<input type="hidden" name="currency" value="USD" />
8
<input type="hidden" name="amount" value="2.00" />
9
<input type="hidden" name="success_url" value="http://www.yourweb.com/SuccessPage" />
10
<input type="hidden" name="cancel_url" value="http://www.yourweb.com" />
11
<!--(Optional)<input type="hidden" name="skip_success_page" value="0" />-->
12
<!--(Optional)<input type="hidden" name="ptr_url" value="http://www.yourweb.com/PtrHandler" />-->
13
<input type="hidden" name="signature" value="Replace with your Hashed Signature*" />
14
<input type="hidden" name="signature_algorithm" value="sha1" />
15
<input type="submit" name="submit" value=" PayBolt" alt="PayBolt" />
16
</form>
Copied!

Button Parameters

Name
Description
version
Fixed. Please use '1'.
action
The action of the current payment. Currently, PayBolt supports only 'capture'
Name
Description
merchant_id
Merchant ID provided by PayBolt.
merchant_reference_id
This ID can be served as the merchant reference ID. This ID should be unique in the merchant system.
currency
Currently, PayBolt supports only 'USD'. Default: 'USD'
amount
The total amount to be charged to the customer. It should be the sum of the subtotal for each item, delivery charge, discounted amount and tax amount.
success_url
URL to go when users have completed the payment in PayBolt page.
cancel_url
URL to go when users click 'Cancel' in PayBolt page.
skip_success_page (optional)
Use
'1' - Yes.
'0' - No (default)
If 'skip_success_page' flag is set to '1', customer will not see the PayBolt success page after payment is made successfully. The customer will instead be redirected back to the provided 'success_url'.
Transaction response and payment details will be added to the 'success_url' and the details are:
  • 'merchant_id'
  • 'merchant_reference_id'
  • 'paybolt_reference_id'
  • 'response_code'
  • 'currency'
  • 'amount'
  • 'signature'
  • 'signature_algorithm'
The description for each field is exactly the same as the PTR fields. Please refer to the ‘PTR Parameters' section for more information.
Eg.
When the payment is made successfully, the customer will be redirected to the Url: http://www.website.com/success?merchant_id=0001283733& merchant_reference_id=yourReference&paybolt_reference_id= PayBoltReference
Name
Description
response_code=1&currency=USD&amount=2.00& signature=52Hoducpo254hoUfhac&signature_algorithm=sha1
ptr_url (optional)
PayBolt Transaction Response Url. When a payment is successfully paid, PayBolt Server will post a PTR to this URL with the transaction details before the customer is redirected to the ' PayBolt Success Page'.
signature
An unique signature generated using the 'Secret Key' found in your merchant setting page.
Concatenating the following fields:
  • Note! Secret Key (Found in your merchant setting page)
  • the form post 'merchant_id' value
  • the form post 'action' value (Eg. 'capture')
  • the form post 'merchant_reference_id' value
  • the form post 'amount' value (Eg. '2.00')
  • the form post 'currency' value (Eg. 'USD')
For more information on the signature generation, please refer to the 'Signature Generation' section.
signature_algorithm
Fixed. Please use 'sha1'.
  1. 1.
    Signature Generation
The signature is used to protect the data exchanged between your server with PayBolt server. The signature should be generated using the following two steps:

Step 1

Concatenate the relevant parameters into a single string (Eg. signature for form post):
1
· Secret Key (Found in your merchant setting page)
2
· The form post 'merchant_id' value
3
· The form post 'action' value (Eg. 'capture')
4
· The form post 'merchant_reference_id' value
5
· The form post 'amount' value (Eg. '2.00')
6
· The form post 'currency' value (Eg. 'USD')
Copied!

Step 2

Hash the concatenated string using SHA1 algorithm.
Sample codes: PHP
1
$dataToBeHashed = $secret_key
2
. $merchant_id
3
. $action
4
. $merchant_reference_id
5
. $amount
6
. $currency;
7
$utfString = mb_convert_encoding($dataToBeHashed, "UTF-8");
8
$signature = sha1($utfString, false);
Copied!

Sample codes: ASP .Net (C#)

1
string dataToBeHashed = SecretKey
2
+ MerchantId
3
+ Action
4
+ MerchantReferenceId
5
+ Amount
6
+ Currency;
7
var sha1 = new SHA1CryptoServiceProvider();
8
var passwordBytes = Encoding.UTF8.GetBytes(dataToBeHashed); var passwordHash = sha1.ComputeHash(passwordBytes);
9
var signature = BitConverter.ToString(passwordHash).Replace("-", string.Empty).ToLowerInvariant();
Copied!
Sample codes: Java
We recommend you to use Apache Commons Codec (version 1.7+) for the hash function.
1
String dataToBeHashed = SecretKey
2
+ MerchantId
3
+ Action
4
+ MerchantReferenceId
5
+ Amount
6
+ Currency;
7
String signature = DigestUtils.sha1Hex(dataToBeHashed);
Copied!

Redirect Method (Signature is not required)

New!
In this method, server to server call is used. Hence the signature is not required in the POST form.
Usage / Flow:
  1. 1.
    Use
  • PHP : Curl
  • C# : HttpWebRequest/HttpWebResponse or WebClient or HttpClient to make a server to server POST to PayBolt server.
  1. 1.
    PayBolt will return a JSON response.
  2. 2.
    Decode the JSON response to retrieve the 'redirect_url'.
  3. 3.
    Redirect the customer to the 'redirect_url' to continue with the payment.
Sample Code
1
<form action="https://api.pboltdev.com/pay/url" method="post" >
2
<!-- For actual LIVE account, use https://api.paybolt.com/pay/url -->
3
<input type="hidden" name="version" value="1" />
4
<input type="hidden" name="action" value="capture" />
5
<input type="hidden" name="merchant_id" value="0001283733" />
6
<input type="hidden" name="merchant_reference_id" value="Order01" />
7
<input type="hidden" name="currency" value="USD" />
8
<input type="hidden" name="amount" value="2.00" />
9
<input type="hidden" name="success_url" value="
10
http://www.yourweb.com/SuccessPage
11
" />
12
<input type="hidden" name="cancel_url" value="
13
http://www.yourweb.com
14
" />
15
<!--(Optional)<input type="hidden" name="ptr_url" value="
16
http://www.yourweb.com/PtrHandler
17
" />-->
18
<input type="submit" name="submit" value="PayBolt" alt="PayBolt" />
19
</form>
Copied!
Please refer to Button Parameters for more parameter information and usage. Note! The "signature" and "signature_algorithm" parameters are not required in this method.

Sample Response (JSON)

{"status":1,"redirect_url":"https://gateway.paybolt.com/pay?sid=47140d8b7eb58b3f1b","message ":"Success"}
Name
Type
Description
status
int
1 - Success
-1 - Failed
redirect_url
string
The url to be used to redirect the customer to immediately.
message
string
Contains success message or fail message
4. [Optional] PayBolt Transaction Response (PTR) Parameters
Whenever a payment is completed successfully, a PayBolt Transaction Response (PTR) will be sent to the URL in ptr_url if it's provided:

Sample code

PTR handler scripts (PHP version):
1
<?php
2
if ($_SERVER["REQUEST_METHOD"]=="POST") {
3
$secret_key = "MERCHANT SECRET KEY";
4
$merchant_id = $_POST['merchant_id'];
5
$merchant_reference_id = $_POST['merchant_reference_id'];
6
$Paybolt_reference_id = $_POST['paybolt_reference_id'];
7
$response_code = $_POST['response_code'];
8
$currency = $_POST['currency'];
9
$amount = $_POST['amount'];
10
$signature = $_POST['signature'];
11
$signature_algorithm = $_POST['signature_algorithm'];
12
$dataToBeHashed = $secret_key
13
.$merchant_id
14
.$merchant_reference_id
15
.$paybolt_reference_id
16
.$response_code
17
.$currency
18
.$amount;
19
$utfString = mb_convert_encoding($dataToBeHashed, "UTF-8");
20
$check_signature = sha1($utfString, false); if ($signature == $check_signature) {
21
// signature matched
22
// check response_code
23
// check if merchant_reference_id has not been marked as paid before this
24
// check if merchant_id is your merchant_id
25
// check if amount and currency are correct
26
// process payment
27
} else {
28
// signature does not matched
29
// log for investigation
30
}
31
}
32
?>
Copied!

PTR parameters

Name
Type
Description
merchant_id
string(70)
Your account email address.
merchant_reference_id
string(30)
Your provided reference Id (the 'merchant_reference_id' field)
paybolt_reference_id
string(30)
The PayBolt reference Id
response_code
int(1)
  1. 1.
    - Completed
  2. 2.
    - Declined
Name
Type
Description
  1. 1.
    - Error
  2. 2.
    - Refunded
currency
string(3)
Currency used in the transaction
amount
decimal(11,2)
Amount paid by the customer using credit card.
signature
string
An unique signature generated using the 'Secret Key' found in your merchant setting page.
Generated by concatenating :
  • Note! Secret Key (Found in your merchant setting page)
  • the PTR parameter 'merchant_id' value
  • the PTR parameter 'merchant_reference_id' value
  • the PTR parameter 'paybolt_reference_id' value
  • the PTR parameter 'response_code' value (Eg. '1')
  • the PTR parameter 'currency' value (Eg. 'USD')
  • the PTR parameter 'amount' value (Eg. '2.00')
For more information on the signature generation, please refer to the 'Signature Generation' section.
signature_algorithm
string(5)
Fixed, 'sha1'.