Create a payout

Definition: POST /v1/payouts

To initiate a payout, you must create a payout object. The parameters of the payout are sent in the message body as a JSON object. There are two ways in which a payout can be initiated:

  • First one is when you create a payout object with all the necessary card details, like in the below example.

    Request:

    POST https://securetest.smart2pay.com/v1/payouts
    Authorization: Basic MTAxMDpnYWJp
    
    {
     "Payout": {
       "MerchantTransactionID": "test_h4",
       "Amount": 1000,
       "Currency": "EUR",
       "Description": "payment product",
       "Card": {
         "HolderName": "John Doe",
         "Number": "4548812049400004",
         "ExpirationMonth": "02",
         "ExpirationYear": "2029"
        }
      }
    }

    Response:

    HTTP/1.1 201 Created
    Content-Type: application/json; charset=utf-8
    
    {
      "Payout": {
        "ID": 214,
        "SiteID": 1010,
        "Created": "20181016133234",
        "MerchantTransactionID": "test_h4",
        "OriginatorTransactionID": null,
        "Amount": "1000",
        "Currency": "EUR",
        "Description": "payment product",
        "StatementDescriptor": null,
        "Status": {
          "ID": 2,
          "Info": "Success",
          "Reasons": []
        }
      }
    }
  • The second one is when you create a payout object containing only the Credit Card Token that was received in a previous card payment.

    If you initiate a Card payment and you set the GenerateCreditCardToken parameter to true, a token element is sent in the response, containing the value of the newly created credit card token.

    The token received in the response can be used to initiate future payouts.

    Request:

    POST https://securetest.smart2pay.com/v1/payouts
    Authorization: Basic MTAxMDpnYWJp
    
    {
      "Payout": {
        "MerchantTransactionID": "s2ptest_i11",
        "Amount": "100",
        "Currency": "EUR",
        "Description": "Payout Token Test",    
        "CreditCardToken": {
          "Value": "C0D510746B513D66093609AA92BDA295"
        }
      }
    }

    Response:

    HTTP/1.1 201 Created
    Content-Type: application/json; charset=utf-8
    
    {
      "Payout": {
        "ID": 219,
        "SiteID": 1010,
        "Created": "20190612130707",
        "MerchantTransactionID": "s2ptest_i11",
        "OriginatorTransactionID": null,
        "Amount": "100",
        "Currency": "EUR",
        "Description": "Payout Token Test",
        "StatementDescriptor": null,
        "Status": {
          "ID": 2,
          "Info": "Success",
          "Reasons": []
        }
      }
    }

In case of an API error, an HTTP 4xx (you did something wrong) or HTTP 5xx (we did something wrong) response is returned.

For more information about the reasons of a wrong request response see our section Card Processing Return Codes.

Request:

POST https://securetest.smart2pay.com/v1/payouts
Authorization: Basic MTAxMDpnYWJp

{
  "Payout": {
    "MerchantTransactionID": "test_h5",
    "Amount": 1000,
    "Currency": "EUR",
    "Description": "payment product"
  }
}

Response:

HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=utf-8

{
  "Payout": {
    "InvalidRequestID": "i3355",
    "ID": null,
    "SiteID": 1010,
    "Created": null,
    "MerchantTransactionID": "test_h5",
    "OriginatorTransactionID": null,
    "Amount": "1000",
    "Currency": "EUR",
    "Description": "payment product",
    "StatementDescriptor": null,
    "Status": {
      "ID": null,
      "Info": null,
      "Reasons": [
      {
        "Code": 1206,
        "Info": "CardDetails are missing"
        }
      ]
    }
  }
}