Migration from API Version 1.5 to Version 1.6 Notes

1) Change your API end point
Old End Point URL: https://www.bttpay.com/pay/authorize/checkout.php
New End Point URL: https://www.bttpay.com/app/checkout/

2) Pass card_name parameter (Credit Card owner name).
You can add another text field in your checkout form to get Card Owner Name.
Example – Name on Card: <input type=’text’ name=’card_name’ required>

3) Pass this card_name value to the api.
Example – https://www.bttpay.com/app/checkout/?card_name=$_POST[‘card_name’]

4) City and State are now required fields

API Documentation Version 1.6

API end point https://www.bttpay.com/app/checkout/
key Your transaction key, you can get it from “my profile” section in your merchant account
amt Total Amount you want to charge, must be in 2 decimal places, without any currency symbol. e.g 100.00 or 100.20
curr 3 digits currency code. Acceptable codes are : SGD, MYR, USD, GBP
mode (optional)       Possible values are: test, live

Default is live. Set mode = test for testing/development environment.

token A unique token will be generated to represent customer’s credit card information. This token will be submitted from Credit Card information form. See a section below for more details.
first_name First name of customer. (required)
last_name Last name of customer. (required)
card_name Credit Card owner name. (required)
email Email ID of customer. (required)
zipcode Zip Code of customer billing address (required)
city Customer’s billing city (required)
state Customer’s billing state (required)
country Customer’s billing country (required), must be in ISO 3 ALPHA format. e.g: USA for United States
address Customer’s billing Address (required)
phone Customer’s phone numer(required)
notify_url URL where results of your transaction will be sent by POST method.
error_url URL where customer will be redirected in case of any error.
success_url URL where users will be taken after a successful

Request

https://www.bttpay.com/app/checkout/?key=$transaction_key&amt=$amount&curr=$currency&mode=$mode&token=$token
&first_name=$first_name&last_name=$last_name&card_name=$card_name&email=$email&zipcode=$zipcode&city=$city&country=$country
&address=$address&phone=$phone&
&notify_url=$notify_url&success_url=$success_url&error_url=$error_url

 

Additional Variables

You can pass variables in the API to keep track of your orders, users or transaction. To pass a variable simply add a name value pair in the API link. For example if you want to pass an order id 20 to your notify_url, you can add it to your API link like &id_order=20. The above link will look like:

https://www.bttpay.com/app/checkout/?key=$transaction_key&amt=$amount&curr=$currency&mode=$mode&token=$token
&first_name=$first_name&last_name=$last_name&card_name=$card_name&email=$email&zipcode=$zipcode&city=$city&country=$country
&address=$address&phone=$phone&
&notify_url=$notify_url&success_url=$success_url&error_url=$error_url

you can add multiple variables. And you can retrieve on your notify_url using $_POST[‘info’][‘id_order’].

Response

You will get this response on your notitify_url page.

success True or false
status Status will have one of the following values
captured
pending
failed
transaction_id Your unique transaction id
time Time of tranasaction in Unix Timestamp
info Array contains information about amount, currency etc
key Your Transaction Key
amt Amount charged from the credit card
curr 3 digits currency code
mode Test or live.
Fee Transaction Fee
Any variable you passed will be available in this array.

 

Getting a Token

This is a simple html form to get credit card information from user.  We recommend not to use name tags in this form to avoid submission of Credit Card information to your server.  Include jquery and bttpay.js.

Above code will create a simple form to get Credit Card details. The code below will submit this information to BttPay server over a secured and encrypted connection. And return you a token . You will require an API Key for this, you can get it from my profile section in your merchants account.

…………………………………………………………*………………………………………………………….*…………………………………………………………….

 

Sample Code

Download Complete Code

Refunding a transaction