Request
Tips
Welcome to the smilepayz Pay API documentation page. Integrate this API to start transacting using smilepayz on your
site.
smilepayz API is a third party API that functions as a payment gateway system . smilepayz API helps you in terms of
receiving online payments from your customers. With just one smilepayz API, you can accept payments from a variety of
available payment methods.
Tips
smilepayz API is a restful Web service, which enables programmatic communication between you and smilepayz payment
system. You can easily integrate to any of your internet-capable system (Web, App, PoS, IoT, etc.) and can fully build &
customize the payment UI, on your side without smilepayz hosted payment UI. smilepayz Core API is suitable for medium
size as well as large size businesses.
HTTP Request
Header Format Structure Components – payin
Service Code | 90 |
---|---|
Name | API transaction pay in |
Version | 1.0 |
HTTP Method | POST |
Path | .../{version}/transaction/pay-in |
Header Parameters
API Header Format Structure for Transaction PayIn:
Area | Field | Attribute | Type | Description |
---|---|---|---|---|
Header | Content-Type | Mandatory | String | String represents indicate the media type of the resource (e.g. application/json, application/pdf) |
Authorization | Mandatory | String | String starts with keyword “Bearer ” followed by access_token (e.g. Bearer eyJraWQiOi...Jzc29zIiiY) | |
X-TIMESTAMP | Mandatory | String | Merchant's current local time in yyyy-MM-ddTHH:mm:ssTZD format | |
X-SIGNATURE | Mandatory | String | Represents signature of a request.Identify Signature Type used | |
ORIGIN | Optional | String | Origin Domain www.yourdomain.com | |
X-PARTNER-ID | Mandatory | String | Merchant_ID. Unique ID for a partner as merchant_id | |
X-EXTERNAL- ID | Mandatory | String | Numeric String. Reference number that should be unique in the same day | |
CHANNEL-ID | Mandatory | String | Fixed value: 95221 |
Notes:
X-SIGNATURE
- HMAC_SHA512 (merchantSecret, stringToSign) with formula stringToSign = HTTPMethod +”:“+ EndpointUrl +":"+
AccessToken +":“+ Lowercase(HexEncode(SHA-256(minify(RequestBody))))+ ":“ + TimeStamp- Complete URL endpoint including all parameters in related URL (Relative path, example: Path in general information
of each API service)- For the minify(Request Body) parameter, in case there is no Request Body then an empty string is used.
- The signature string is generated from string to sign above with applying HMAC_SHA512 hashing using secret key which
given by smilepayz, and then encode the result to base64.- Put the signature string into HTTP header “ X-SIGNATURE“ when call smilepayz’s API.
- which merchantSecret you can find this page.Please note that the sandbox env is different from the production env.
Tips
Example Header – Transaction Request:
Content-type: application/json
Authorization: Bearer gp9HjjEj813Y9JGoqwOeOPWbnt4CUpvIJbU1mMU4a11MNDZ7Sg5u9a"
X-TIMESTAMP: 2020-12-17T10:55:00+07:00
X-SIGNATURE: 7MHd9v5/m9JeqmDZVwWBZUZ5J5...7120QnFEny7Qm7uQR1G0TWCh10fsU6nVxiRoeoQ==
ORIGIN: www.hostname.com
X-PARTNER-ID: 20001
X-EXTERNAL-ID: 41807553358950093184162180797837
CHANNEL-ID: 95221
Body Parameters
Area | Field | Attribute | Type | Description |
---|---|---|---|---|
Body | orderNo | Mandatory | String(32) | String transaction Unique ID. |
purpose | Mandatory | String(64) | String The reason to transaction | |
productDetail | Optional | String(128) | String The subject matter of this transaction | |
additionalParam | Conditional | Object | Object TradeAdditionalReq Refer to Data AdditionalReq | |
itemDetailList | Optional | List(ItemDetail) | Object The products for this transaction. Refer to Data ItemDetail | |
billingAddress | Optional | Address | Object Address for billing. Refer to Data BillingAddress | |
shippingAddress | Optional | Address | Object Address for shipping,Refer to Data ShippingAddress | |
money | Mandatory | Money | Object Net amount of the transaction. Refer to Data Money | |
redirectUrl | Optional | String(256) | Redirect to customer url | |
merchant | Mandatory | Merchant | Object merchant information. Refer to Data Merchant | |
paymentMethod | Optional | String | String Payment option which shows the provider of this payment. Refer to Data PaymentMethod | |
payer | Optional | Payer | Object Transaction initiator. Refer to Data Payer | |
receiver | Optional | Receiver | Object Trading beneficiaries. Refer to Data Receiver | |
expiryPeriod | Optional | Number | Validity period of payment link (in seconds) Example: 3600 | |
area | Conditional | Integer | Area code Which region's api are you requesting? if null the default value is 10 that belongs to INDONESIA, Others refer to Data Area |
Tips
Example Body – Transaction Request:
POST .../v1.0/transaction/pay-in HTTP/1.2
Content-type: application/json
Authorization: Bearer gp9HjjEj813Y9JGoqwOeOPWbnt4CUpvIJbU1mMU4a11MNDZ7Sg5u9a"
X-TIMESTAMP: 2020-12-17T10:55:00+07:00
X-SIGNATURE: 7MHd9v5/m9JeqmDZVwWBZUZ5J5...7120QnFEny7Qm7uQR1G0TWCh10fsU6nVxiRoeoQ==
ORIGIN: www.hostname.com
X-PARTNER-ID: 20001
X-EXTERNAL-ID: 41807553358950093184162180797837
CHANNEL-ID: 95221
{
"orderNo": "2020102900000000000001",
"purpose": "transaction for business bla bla",
"productDetail": "electronics. Apple",
"additionalParam": {},
"paymentMethod": "BRI",
"money": {
"currency": "IDR",
"amount": 10000
},
"itemDetailList": [
{
"name": "Apple Mac",
"quantity": 1,
"price": 10000
}
],
"billingAddress": {
"countryCode": "Indonesia",
"city": "Djakarta",
"address": "djakarta #1002873",
"postalCode": "10045",
"phone": "62895359978010"
},
"shippingAddress": {
"countryCode": "Indonesia",
"city": "Djakarta",
"address": "djakarta #1002873",
"postalCode": "10045",
"phone": "62895359978010"
},
"merchant": {
"merchantId": "20001",
"merchantName": "Betty",
"accountNo": "22102014422"
},
"payer": {
"name": "Betty",
"email": "[email protected]",
"phone": "62895359978010"
},
"receiver": {
"name": "Vincent.CH",
"phone": "62895359978010",
"email": "[email protected]"
},
"expiryPeriod": 3600,
"area": "10"
}