Genome Documentation

Payout API

Payout API

Overview

Genome provides merchants functionality which allows to make payouts to their customers.

Web ServiceURL
Live Genome Payout API Servicehttps://api.genome.eu/api/pf/payout

Payout request formats

  • POST-request
    To use POST type a request header should contain “Content-Type: application/x-www-form-urlencoded”, request content should be transmitted as a serialized string key1=value1&key2=value2

Payout on credit card

Parameters of the payout request on credit card via full credit card data:

Parameter nameRequiredFormat and ruleDescription
api_versionyesfloat
Possible value: 1
API version
merchant_accountyesstring (6-32)Merchant API login
merchant_passwordyesstring (6-32)Merchant API password
methodyesstring
Possible value: init
Method for the payout request
transaction_unique_idyesstring (11-45)Transaction unique identifier in Merchant system.
mid_referenceoptionalstring (16)MID reference in Genome system
amountyesfloat (0 - 9999999.9999)Payout transaction amount
currencyyesstring (3)
ISO 4217 (alfa-3)
Payout transaction currency
callback_urlyesNot Empty String
https required
Once the order has been processed merchant will receive a final response (callback) regarding the transaction status to this URL
user_idyesstring (1-32)User Id on merchant's side
user_emailyesstring (6-255)Customer's email address
user_ipoptionalstring (IPv4, IPv6)Customer's IP address. Not all acquirers support IPv6 format
user_first_nameoptionalstring (1-32)The first name of the customer
user_last_nameoptionalstring (1-32)The last name of the customer
user_addressoptionalstring (2-64)Customer's address
user_cityoptionalstring (2-32)Customer's city
user_stateoptionalstring (1-32)Customer's state
user_countryoptionalstring (2-3)
ISO 3166-1 alpha-3
Customer's country
user_zipoptionalstring (2-10)Customer's zip
user_phoneoptionalstring (7-15)Customer's phone number. For testmode the value should be passed with + symbol
card[card_number]yesstring (13-19 digits)
Luhn algorithm
Number of the card
card[card_exp_month]optionalstring (2 digits)Card expiration month. Month number from '01' to '12'
card[card_exp_year]optionalstring (4 digits)Card expiration year
card[card_cvv]optionalstring (3-4 digits)Card Verification Value
card[card_holder]optionalstring (2-32)Cardholder name

Sample code of the Payout by Credit card request in application/json format:

{
"api_version": 1,
"method": "init",
"merchant_account": "Account_MP_TRX",
"merchant_password": "password123",
"transaction_unique_id": "payout_via_cc",
"amount": 10,
"currency": "USD",
"callback_url": "https://merchant.com/callback",
"user_id": "user123",
"user_ip": "127.0.0.1",
"user_email": "john.doe@example.com",
"card": {
"card_cvv": "029",
"card_number": "4012000300001003",
"card_holder": "John Doe",
"card_exp_year": "2022",
"card_exp_month": "07"
}
}

Response parameters:

Parameter nameFormat and ruleDescription
session_idstring (36)Unique session Id of the request
timestampinteger
unix timestamp
Payout API response time
statusstring
Possible values: success, decline, error
Status of the request to Payout API
codeinteger (1-4)Response code of the request
messagestring (6-255)Response message of the request

Sample code of the Payout by Credit card response in application/json format:

{
"sessionid": "5118fcfc-2d9c-492c-9f7c-21470c",
"timestamp": 1531741112,
"status": "pending",
"code": 0,
"message": "Request processed successfully"
}

Notice: in case of successful request merchant will receive status=pending and code=0 in response. Be advised that the final status of the payout request merchant will receive in callback data, more details regarding callback data is provided below.

Notice: Response is not a finished status of the transaction. Finished status will be sent in callback request.

Payout via Token

Merchant can use Token value instead of full credit card data. Token is hashed data of the credit card. Token value contains of credit card number, expiry date and card holder name.

Parameters of the payout request on credit card via Token:

Parameter nameRequiredFormat and ruleDescription
api_versionyesfloat
Possible value: 1
API version
merchant_accountyesstring (6-32)Merchant API login
merchant_passwordyesstring (6-32)Merchant API password
methodyesstring
Possible value: init
Method for the payout request
transaction_unique_idyesstring (11-45)Transaction unique identifier in Merchant system.
mid_referenceoptionalstring (16)MID reference in Genome system
amountyesfloat (0 - 9999999.9999)Payout transaction amount
currencyyesstring (3)
ISO 4217 (alfa-3)
Payout transaction currency
callback_urlyesNot Empty String
https required
Once the order has been processed merchant will receive a final response (callback) regarding the transaction status to this URL
user_idyesstring (1-32)User Id on merchant's side
user_emailyesstring (6-255)Customer's email address
user_ipoptionalstring (IPv4, IPv6)Customer's IP address. Not all acquirers support IPv6 format
user_first_nameoptionalstring (1-32)The first name of the customer
user_last_nameoptionalstring (1-32)The last name of the customer
user_addressoptionalstring (2-64)Customer's address
user_cityoptionalstring (2-32)Customer's city
user_stateoptionalstring (1-32)Customer's state
user_countryoptionalstring (2-3)
ISO 3166-1 alpha-3
Customer's country
user_zipoptionalstring (2-10)Customer's zip
user_phoneoptionalstring (7-15)Customer's phone number. For testmode the value should be passed with + symbol
card[card_token]yesstring (36)Hashed value of card number, expiry date and cardholder name
card[card_holder]optionalstring (2-32)Cardholder name

Sample code of the Payout by Token request in application/json format:

{
"api_version": 1,
"method": "init",
"merchant_account": "Account_MP_TRX",
"merchant_password": "password123",
"transaction_unique_id": "payout_via_token",
"amount": 10,
"currency": "USD",
"callback_url": "https://merchant.com/callback",
"user_id": "user123",
"user_ip": "127.0.0.1",
"user_email": "john.doe@example.com",
"card": {
"token": "5aaaa194-1d68-4ef8-a72f-009184ee03a6",
"card_holder": "John Doe"
}
}

Response parameters:

Parameter nameFormat and ruleDescription
session_idstring (36)Unique session Id of the request
timestampinteger
unix timestamp
Payout API response time
statusstring
Possible values: success, decline, error
Status of the request to Payout API
codeinteger (1-4)Response code of the request
messagestring (6-255)Response message of the request

Sample code of the Payout by Token response in application/json format:

{
"sessionid": "5118fcfc-2d9c-492c-9f7c-21470a",
"timestamp": 1531741112,
"status": "pending",
"code": 0,
"message": "Request processed successfully"
}

Notice: in case of successful request merchant will receive status=pending and code=0 in response. Be advised that the final status of the payout request merchant will receive in callback data, more details regarding callback data is provided below.

Notice: Response is not a finished status of the transaction. Finished status will be sent in callback request.

Payout callback

Callback request parameters:

Parameter nameFormat and ruleDescription
tokenstring (36)Hashed value of card number, expiry date and cardholder name
referencestring (20)Reference of the transaction in Genome system
transaction_unique_idstring (11-45)Unique transaction Id
statusstring
Possible values: success, decline, error
Status of the transaction
codeinteger (1-4)Response code regarding the transaction result
messagestring (6-255)Response message regarding the transaction result
checkSumstring (64)Signature for callback parameters

Example of callback request to merchant in "application/x-www-form-urlencoded" format:

token=5aaaa194-1d68-4ef8-a72f-009184ee03a6
&reference=PTFF00000000396580CF
&transaction_unique_id=payout_0716100000
&status=success
&code=0
&message=Transaction processed successfully
&checkSum=4804928393234a6cd05f177569147091d7138da25fc61d9ee5add357017239a6

Genome sends callback data to merchant in application/x-www-form-urlencoded format. Callback is received to a merchant when in response Genome got the code - 200 (it's required), and body text - OK (it's optional). In other cases, callback is not received to merchant and Genome will try periodically to re-send callback data. The number of attempts are limited.

checkSum calculation

checkSum calculation allows to compare value of the checkSum in callback request with own calculation.

PHP algorithm below shows the calculation logic of “checkSum”:

<?php
// Example of the callback request to merchant, application/x-www-form-urlencoded format.
$callbackData = 'token=5aaaa194-1d68-4ef8-a72f-009184ee03a6&reference=PTFF00000000396580CF&transaction_unique_id=payout_0716100000&status=success&code=0&message=Transaction processed successfully&checkSum=4804928393234a6cd05f177569147091d7138da25fc61d9ee5add357017239a6';
// Example of the sorted parameters. Also, private key, provided by Genome is added in the end of the line.
$sortedData = 'code=0|message=Transaction processed successfully|reference=PTFF00000000396580CF|status=success|token=5aaaa194-1d68-4ef8-a72f-009184ee03a6|transaction_unique_id=payout_0716100000|your_private_key';
// Getting the result of checkSum calculation
$countedCheckSum = hash('sha256', $sortedData);
?>

If you need to calculate and compare the value checkSum callback, use the algorithm described below:

Make notice, that all callback values take a part in calculation of the checkSum parameter.

  • excluded from the array checkSum field, then sort the array by key in the alphabetical order, form a line on the principle: key1 = value1 | key2 = value2 | switchN = valueN | your_private_signature from the sorted array

Make notice, that a value of the your_privat_signature is your current merchant account password

If fully translate callback shown in the example into the line we get:

  • code=0|message=Transaction processed successfully|reference=PTFF00000061B7146A8B|status=success|token=43d206b5-af88-4770-9d08-0c7eb17b000|transaction_unique_id=000453542|your_privat_signature

  • The next step is to calculate hash for the obtained line by hash sha256, the result should match the line transfered in checkSum field. $countedCheckSum = hash('sha256','code=0|message=Transaction processed successfully|reference=PTFF00000061B7146A8B|status=success|token=43d206b5-af88-4770-9d08-0c7eb17b000|transaction_unique_id=000453542|your_privat_signature');

  • If the values coincide - the signature is valid.

Transaction statuses

Payout transaction statuses:

StatusDescription
NEWtransaction payout created
SUCCESStransaction processed successfully
ERRORtransaction error
DECLINEDtransaction declined
VOIDEDtransaction is voided
PROCESSINGtransaction processing
PENDING_PROCESSINGtransaction in queue
PROCESSING_POSTBACKprocessing postback

Payout response codes

List of the response codes for payout transactions:

ModuleCodeMessage (can be extended depending on case)
Payout3300GENERAL DECLINE
3310VALIDATION DECLINE
3311INVALID MID REFERENCE
3330UNREGISTERED CARD