Payout API

Payout API

Overview

Genome provides merchants with functionality that allows them to make payouts to their customers.

Web service URL
Live Genome payout API service https://api.genome.eu/api/pf/payout

Card payouts are available only for merchants whose country of business registration is one of the following: Austria, Belgium, Denmark, Estonia, Finland, France, Germany, Hungary, Ireland, Italy, Malta, Netherlands, Norway, Poland, Portugal, Spain, Sweden, Switzerland, UK. For other merchants, a payout request is rejected with code 3116 (MID does not support the country).

The payout amount and fees are reserved from your merchant balance; if the balance is insufficient, the payout fails with code 3101.

Payout request formats

  • POST-request
    To use the JSON type, a request header should contain "Content-Type: application/json". The request content should be transmitted as a json-object as in the samples below. application/x-www-form-urlencoded is not supported.

Payout on credit card

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

Parameter name Required Format and rule Description
api_version yes float
Possible value: 1
API version
merchant_account yes string (6-32) Merchant API login
merchant_password yes string (6-32) Merchant API password
method yes string
Possible value: init
Method for the payout request
transaction_unique_id yes string (11-45) Transaction unique identifier inside the merchant system. Must be unique per merchant account; a repeated value is rejected with a code 3001.
mid_reference optional string (16) MID reference inside the Genome system
amount yes float (0.01 - 9999999) Payout transaction amount
currency yes string (3)
ISO 4217 (alfa-3)
Payout transaction currency. Must be enabled for your merchant account (code 3015 otherwise). XTS = test currency
callback_url yes Not Empty String
https required
Once the order has been processed, the merchant will receive a final response (callback) regarding the transaction status at this URL
user_id optional string (1-50) User ID on merchant's side
user_email yes string (6-255) Customer's email address
user_ip optional string (IPv4, IPv6) Customer's IP address. Not all acquirers support the IPv6 format
user_first_name optional string (1-32) The first name of the customer
user_last_name optional string (1-32) The last name of the customer
user_address optional string (2-64) Customer's address
user_city optional string (2-32) Customer's city
user_state optional string (1-2) Customer's state or province code (see State and province codes)
user_country optional string (2-3)
ISO 3166-1 alpha-3
Customer's country
user_zip optional string (2-10)
letters, digits, spaces, hyphens
Customer's ZIP
user_phone optional string (7-15) Customer's phone number. For testmode the value should be passed with + symbol
card yes object Card data
card.card_number yes string (13-19 digits)
Luhn algorithm
Number of the card
card.card_exp_month yes string (1-2 digits, 1-12) Card expiration month. Month number from '01' to '12'. The card must not be expired
card.card_exp_year yes string (4 digits; 2 digits accepted as 20YY) Card expiration year. The card must not be expired
card.card_cvv optional string (3-4 digits) Card Verification Value
card.card_holder yes string (2-32) Cardholder name

Sample code of the payout by credit card request in the 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": "2030",
"card_exp_month": "07"
}
}

Response parameters:

Parameter name Format and rule Description
session_id string (36) Unique session ID of the request
timestamp integer
unix timestamp
Payout API response time
status string
Possible values: success, decline, error
Status of the request to the payout API. pending with code 0= accepted; wait for the callback
code integer (1-4) Response code of the request
message string (6-255) Response message of the request

Sample code of the payout by credit card response in the application/json format:

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

Notice: In case of a successful request, the merchant will receive status=pending and code=0 in response. Be advised that the final status of the payout request will be received by the merchant in the callback data. More details regarding callback data are provided below.

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

Notice: The payout response carries no reference; correlate by your transaction_unique_id. The Genome reference is sent in the callback. Ignore unknown custom_* fields.

Payout via token

Payout via token is not currently supported.

A merchant can use a token value instead of full credit card data. A token is hashed data of the credit card. The token value contains the credit card number, expiry date, and cardholder name.

Parameters of the payout request on credit card via token:

Parameter name Required Format and rule Description
api_version yes float
Possible value: 1
API version
merchant_account yes string (6-32) Merchant API login
merchant_password yes string (6-32) Merchant API password
method yes string
Possible value: init
Method for the payout request
transaction_unique_id yes string (11-45) Transaction unique identifier inside the Merchant system. Must be unique per the merchant account; a repeated value is rejected with a code 3001.
mid_reference optional string (16) MID reference inside the Genome system
amount yes float (0.01 - 9999999) Payout transaction amount
currency yes string (3)
ISO 4217 (alfa-3)
Payout transaction currency. Must be enabled for your merchant account (code 3015 otherwise). XTS = test currency
callback_url yes Not Empty String
https required
Once the order has been processed, the merchant will receive a final response (callback) regarding the transaction status at this URL
user_id optional string (1-50) User ID on merchant's side
user_email yes string (6-255) Customer's email address
user_ip optional string (IPv4, IPv6) Customer's IP address. Not all acquirers support the IPv6 format
user_first_name optional string (1-32) The first name of the customer
user_last_name optional string (1-32) The last name of the customer
user_address optional string (2-64) Customer's address
user_city optional string (2-32) Customer's city
user_state optional string (1-2) Customer's state or province code (see State and province codes)
user_country optional string (2-3)
ISO 3166-1 alpha-3
Customer's country
user_zip optional string (2-10)
letters, digits, spaces, hyphens
Customer's ZIP
user_phone optional string (7-15) Customer's phone number. For the test mode, the value should be passed with a “+” symbol
card yes object Card data
card.card_token yes string (36) Hashed value of the card number, expiry date, and cardholder name
card.card_holder yes string (2-32) Cardholder name

Sample code of the payout by token request in the 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 name Format and rule Description
session_id string (36) Unique session ID of the request
timestamp integer
unix timestamp
Payout API response time
status string
Possible values: pending, success, decline, error
Status of the request to Payout API. pending with code 0= accepted; wait for the callback
code integer (1-4) Response code of the request
message string (6-255) Response message of the request

Sample code of the payout by token response in the application/json format:

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

Notice: In case of a successful request, the merchant will receive status=pending and code=0 in response. Be advised that the final status of the payout request will be received by the merchant in the callback data. More details regarding callback data are provided below.

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

Notice: The payout response carries no reference; correlate by your transaction_unique_id. The Genome reference is sent in the callback. Ignore unknown custom_* fields.

Payout callback

Callback request parameters:

Parameter name Format and rule Description
token string (36) Hashed value of the card number, expiry date, and cardholder name
reference string (20) Reference of the transaction inside the Genome system
transaction_unique_id string (11-45) Unique transaction ID
status string
Possible values: success, decline, error
Status of the transaction
code integer (1-4) Response code regarding the transaction result
message string (6-255) Response message regarding the transaction result
checkSum string (64) Signature for callback parameters

Example of the callback request to merchant in the "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 the merchant in application/x-www-form-urlencoded format. The callback is received by the merchant when, in response, Genome gets the code - 200 (it's required) and body text - OK (it's optional). In other cases, the callback is not received by the merchant, and Genome will try to re-send the callback data periodically. The number of attempts is limited.

A callback is sent when the payout reaches a final status: success, decline, or error. Requests that were rejected synchronously (status error in the response) produce no callback.

To check a payout, send a host-to-host CHECK request with your transaction_unique_id.

checkSum calculation

The checkSum calculation allows comparing the value of the checkSum in the callback request with own calculation.

The 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 of the checkSum callback, use the algorithm described below:

Note that all callback values take part in the calculation of the checkSum parameter.

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

Note that the value of the your_private_signatureis your current merchant account password.

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

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

  • The next step is to calculate the hash for the obtained line by hash sha256, the result should match the line transferred 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_private_signature');

  • If the values coincide, the signature is valid.

Transaction statuses

Payout transaction statuses:

Status Description
pending payout accepted; the final status comes in the callback
success payout completed
decline payout declined
error processing error

Payout response codes

List of the response codes for payout transactions:

ModuleCodeMessage (can be extended depending on the case)
Payout1GENERAL SYSTEM ERROR
11INTERNAL SERVICE TIMEOUT
1004INVALID PARAMETER (message: '<field>: <reason>')
2001INVALID MERCHANT ACCOUNT OR PASSWORD
2003MERCHANT ACCOUNT IS NOT ACTIVE
2009MERCHANT NOT ACTIVE
3000GENERAL PROCESSING ERROR
3001TRANSACTION ID DUPLICATE
3015INVALID CURRENCY
3101INSUFFICIENT FUNDS
3113TRANSACTION NOT SUPPORTED BY MID
3116COUNTRY NOT SUPPORTED BY MID

Acquirer decline codes can also be returned; see the Response codes page.