<aside> ⚠️ Do not use Ajax request to POST data.
</aside>
Sample Request
POST /checkout HTTP/1.1
Host: <https://sandbox.giyapay.com>
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache
{
"success_callback": "<https://example.com/success-callback>",
"error_callback": "<https://example.com/error-callback>",
"cancel_callback": "<https://example.com/cancel-callback>",
"merchant_id": "merchant1234",
"amount": "31299",
"currency": "PHP",
"nonce": "d5c9154f3dded3bfb83dcf14e107f5036b39db6c2a6bcdaaacb21e60fe",
"timestamp": "12413234233",
"description": "This is a test",
"signature": "175924379fa10585b0e829c09f9e395ed9e81c0d31d2957e8dc0f51619fc5084336f9fde519b33d07795ab143ce1a00e0a74b6421e1ee95dae8a4652ba50eb8c",
"payment_method": "GCASH",
"order_id": "12345"
}
Request Endpoint (HTTP POST Method)
POST to the following URL to create a transaction.
https://sandbox.giyapay.com/checkout
<aside> 💡 Request should be done on html form element. See implementation below.
</aside>
Request Body
The transaction details should be inside the html form with POST method.
<form action="<https://sandbox.giyapay.com/checkout>" method="post">
<div>
<input type="hidden" name="success_callback" value="<https://example.com/success-callback>"/>
<input type="hidden" name="error_callback" value="<https://example.com/error-callback>"/>
<input type="hidden" name="cancel_callback" value="<https://example.com/cancel-callback>"/>
<input type="hidden" name="merchant_id" value="merchant1234"/>
<input type="hidden" name="amount" value="3129900"/>
<input type="hidden" name="currency" value="PHP"/>
<input type="hidden" name="nonce" value="bjqn7mxZW6rzLaQI0oNO5rp3mg7T0jlvppx3SKoxq0zHxIjlay"/>
<input type="hidden" name="timestamp" value="12413234233"/>
<input type="hidden" name="description" value="This is a test"/>
<input type="hidden" name="signature" value="19e9c086e86a19179a420ddd44acdcf9e8ef842ffe9d371b3cb7a13bd5123d2d8e807fbeebf58c3823383078255c5e66caae97bb32e67552b616b29dfd692d66"/>
<input type="hidden" name="payment_method" value="MASTERCARD/VISA" />
<input type="hidden" name="order_id" value="12345" />
<p style="margin-bottom: 5px;">
<input type="image" id="image" alt="Checkout" src="<https://pay.giyapay.com/images/demo/btn-mastercard-visa.svg>">
</p>
</div>
</form>
Parameters and Options
Parameters
success_callback (REQUIRED)
error_callback (REQUIRED)
cancel_callback
(REQUIRED)
merchant_id (REQUIRED)
amount (REQUIRED)
currency (REQUIRED)
nonce (REQUIRED)
timestamp (REQUIRED)
description (OPTIONAL)
signature (REQUIRED)
payment_method (REQUIRED)
order_id
(OPTIONAL)
Description
String. A callback url when the payment successfully created.
String. A callback url when the payment got an error.
String. A callback url when the payment cancelled.
String. Your merchant id for Giyapay.
Integer. Total amount of the payment in cents. Formula on getting the integer amount:
<aside> 💡 If your price is PHP 99.50, then: amount = 99.50 x 100 amount = 9950
</aside>
String. A system of money in your country that is being used. For now, only PHP is available.
String. A unique random string.
Integer. The UNIX Timestamp of the current date and time. This is used as a security measure.
String. The description of the transaction. This will be shown to the buyer or customer.
String. See the signature create call for more information.
String. The default payment for your Giyapay transaction.
<aside> 💡 Payment Methods
</aside>
String. Your transaction order id.
Generating the Signature
When creating a signature key, you need to concatenate the merchant_id, amount, currency, timestamp, nonce and your merchant secret key. Hash the string to SHA512 algorithm. For example on nodejs:
import crypto from "crypto";
const myStringForHashing = 'merchant_id' + 'amount' + 'currency' + 'order_id' + 'timestamp' + 'nonce' + '(your merchant secret key)';
const signatureKey = crypto.createHash('sha512').update(myStringForHashing)
.digest('hex');
Example of a success callback
https://test.giyapay.com/demo-success-page?nonce=5d09cb11faac5ba3067b4665a6929a1463bdf1e6c90e75487c737570460a482b318f782193f2061691e7e171e29580e4bcbec31854012c0d4028710c793a4c6e&order_id=&refno=8D4U-2VAL-CJ1O-RDL1×tamp=1626418739994&amount=10000&signature=565589e47f7121b34142cfe2708145098026e484b406d9e38c600d0673464220328e53fe63b9bc5256c4bebfbedcc3a3fc45b2e4795b85a94d4d55904a5ea4d5