[go: up one dir, main page]

0% found this document useful (0 votes)
290 views9 pages

Api For Ecpay Channel Documentation: Release 0.2.0-Alpha

The document summarizes an API for processing transactions through the ECPay payment channel. It includes endpoints for validating transactions using a GET request with transaction ID, amount, and message digest, and processing transactions using a POST request with transaction ID and status. The GET endpoint returns status codes to indicate if a transaction is valid, while the POST endpoint updates the transaction status in the system. Details are provided on generating the required message digest to validate transactions with the GET endpoint.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
290 views9 pages

Api For Ecpay Channel Documentation: Release 0.2.0-Alpha

The document summarizes an API for processing transactions through the ECPay payment channel. It includes endpoints for validating transactions using a GET request with transaction ID, amount, and message digest, and processing transactions using a POST request with transaction ID and status. The GET endpoint returns status codes to indicate if a transaction is valid, while the POST endpoint updates the transaction status in the system. Details are provided on generating the required message digest to validate transactions with the GET endpoint.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

API for ECPay Channel Documentation

Release 0.2.0-alpha

XCHAIN Devs

Jul 17, 2018


CONTENTS:

1 [GET] - Validate Transaction 1


1.1 Send Transaction ID and amount to our endpoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

2 [POST] - Transaction Processed 3


2.1 Send Transaction ID with details to Endpoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

3 Search 5

i
ii
CHAPTER

ONE

[GET] - VALIDATE TRANSACTION

1.1 Send Transaction ID and amount to our endpoint

Checks if transaction is valid for processing


URL Endpoint: api/v1/channels/ecpay/
Method: GET

Channel sends Transaction ID, Amount along with another parameter passed as “d” which is a message digest
(SHA256) of the two parameters mentioned. See Message Digest Section

Additional Headers:

name value
Authorization Token <Access Token>

Parameters:

name type description


txn_id str Transaction ID
amount str Amount to be paid
d str SHA256 Digest of txn_id:amount

Responses:

Code Description
200 Transaction is Valid
400 Invalid Data. Check params and/or digest
401 Invalid Authorization. Check Headers
404 Payment Not Found

1
API for ECPay Channel Documentation, Release 0.2.0-alpha

1.1.1 Example

Request:

https://<domain>/api/v1/channels/ecpay/?txn_id=PPG7PO5D7&amount=2000.00&
˓→d=d79861cdf0b49a33502e5b2bba0b4dfecc729f643326d9cf643278448b0f40aa

Response:

CODE 200 OK
{
"success": "Transaction valid"
"details": "EA34gFv56LOpwksl12MsdEaC"
}

Message Digest

1.1.2 Prepare String

To create the digest take the txn_id, name_mobile, amount parameters and join/concatenate them using the colon(:) as
delimiter
Example:

PPG7PO5D7:2000.00

1.1.3 Hash the String

Just use SHA-256 algorithm to hash/digest the string.


Use this hash/digest as the d parameter for the API
Sample Code (python):

import hashlib

digest = hashlib.sha256('PPG7PO5D7:2000.00').hexdigest()
print digest

Output:

af65df80b8dfde27a195f6f882159694235d4d1fd3b9c23e868e612f41fc38ee

2 Chapter 1. [GET] - Validate Transaction


CHAPTER

TWO

[POST] - TRANSACTION PROCESSED

2.1 Send Transaction ID with details to Endpoint

Once transaction has been processed pass the Transaction ID along with the details parameter
URL Endpoint: api/v1/channels/ecpay/
Method: POST

Channel sends Transaction ID

Additional Headers:

name value
Authorization Token <Access Token>

Body Type: application/json


Parameters:

name type description


txn_id str Transaction ID
status str “success”/”failed”/”pending”
remarks str Remarks if any (not required)
details str details string from Validation GET (not required)

Responses:

Code Description
200 Transaction/Payment Updated
400 Invalid Data.
401 Invalid Authorization. Check Headers
404 Payment Not Found

3
API for ECPay Channel Documentation, Release 0.2.0-alpha

2.1.1 Example

Request:

{
"txn_id": "PPG7PO5D7",
"status": "success",
"remarks": "",
"details": "EA34gFv56LOpwksl12MsdEaC"
}

Response:

Code: 200 OK
{
"msg": "Transaction Updated"
"status": "sucess"
}

4 Chapter 2. [POST] - Transaction Processed


CHAPTER

THREE

SEARCH

• search

You might also like