docs
NAV
cURL Java PHP Python Ruby

Topics

API Endpoints

We provide two distinct base urls for making API requests depending on whether you would like to utilize the sandbox or production environments. These two environments are completely separate and share no information, including API credentials. For testing please use the Staging API and when you are ready to process live transactions use the Production endpoint.

Authentication

# With CURL, just supply your username as basic auth (-u) in the header of each request as follows:

curl https://api-test.payline.io/ \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98

/*
Add the following to your pom.xml (Maven file):

<dependency>
  <groupId>io.payline.payments.processing.client</groupId>
  <artifactId>payline-data</artifactId>
  <version>${version}</version>
</dependency>

...

<repositories>
  <repository>
    <id>oss-snapshots</id>
    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    <snapshots>
      <enabled>true</enabled>
    </snapshots>
  </repository>
</repositories>

*/

import io.payline.payments.ApiClient;
import io.payline.payments.views.*;
import io.payline.payments.forms.*;

//...

public static void main(String[] args) {

  ApiClient api = ApiClient.builder()
                  .url("https://api-test.payline.io")
                  .user("US8YbNRmfhgnS8YkEb8cLTE2")
                  .password("3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98")
                  .build();
//...



<?php
// Download the PHP Client here: https://github.com/Payline/payline-php

require_once('vendor/autoload.php');
require(__DIR__ . '/src/Payline/Settings.php');

Payline\Settings::configure([
    "root_url" => 'https://api-test.payline.io',
    "username" => 'US8YbNRmfhgnS8YkEb8cLTE2',
    "password" => '3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98']
    );

require(__DIR__ . '/src/Payline/Bootstrap.php');
Payline\Bootstrap::init();



# To install the python client run the command below from your terminal:
# pip install payline

import payline

from payline.config import configure
configure(root_url="https://api-test.payline.io", auth=("US8YbNRmfhgnS8YkEb8cLTE2", "3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98"))

# To download the Ruby gem:
# gem install payline-data

require 'payline'

Payline.configure(
    :root_url => 'https://api-test.payline.io',
    :user=>'US8YbNRmfhgnS8YkEb8cLTE2',
    :password => '3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98'
)

To communicate with the Payline API you’ll need to authenticate your requests via http basic access authentication with a username and password, which you can locate in your dashboard. If you do not have a dashboard feel free to test the API with the credentials below:

Your Application is a resource that represents your web app. In other words, any web service that connects buyers (i.e. customers) and sellers (i.e. merchants).

Idempotency Requests

You’ll notice the authorization and transfer object have a field named idempotency_id which ensures the API request is only performed once. Why is this important? We’ve all experienced a hanging request while on a checkout page and feared that if we refresh or submit the payment again we’ll be charged twice. With Payline, we remove the ambiguity by having the user generate a unique idempotency_id and sending it with the normal payload. If the user attempts a request with the same idempotency_id, the response will raise an exception. Now you can rest assured that when you create an authorization or debit a bank account that the user will be protected from potential network issues by simply passing idempotency_id in body of the request.

Tags

All Payline objects (i.e. Authorization, Application, Identity, Merchant, Payment Instrument, Settlement, Transfer) include a tags attribute that allows the user to include key-value metadata to their object. For example, when creating a Payment Instrument, you may want to include more data about the card. Simply pass a custom key and value, such as “card-type”: “business card”. Or when creating an Authorization, you may want to include specific information about the transaction, such as a unique ID or additional information about the transaction.

Testing for specific responses and errors

Before taking your integration to production, use the information below to test it thoroughly.

Amount Description
100 Success amount
102 Failed amount
103 Canceled amount
104 Exception amount
888888 Disputed amount
193 Insufficient funds amount
194 Invalid card number amount
889986 AVS total failure amount
889987 CVC failure amount
889988 Risk amount canceled amount
Card Description
4957030420210454 Payment card positive result
4000000000000036 Payment card AVS total failure
4000000000000127 Payment card CVC failure

Errors

Error Code Meaning
400 Bad Request – You’ve attemped an invalid request
401 Unauthorized – You have used the incorrect API key
402 Upstream Processor Error – Errors caused by 3rd party service
404 Not Found – The specified resource could not be found
422 Unprocessable Entity – The parameters were valid but the request failed. The error is usually some misunderstanding of various steps that have to be executed in order (e.g. attempting to initiate a transfer on behalf of a merchant that has not yet been approved)
500 Internal Server Error – We had a problem with our server. Try again later.

Guides

Overview

These guides provide a collection of resources for utilizing the Payline API and its client libraries. We offer a number of client libraries for interfacing with the API, and you can view example code snippets for each in the dark area to the right.

  1. Authentication: Learn how to properly authenticate and interface with the API.

  2. Getting Started: A step-by-step guide demonstrating the basic workflow of charging a card. This guide will walk you through provisioning merchant accounts, tokenizing cards, charging those cards, and finally settling (i.e. payout) those funds out to your merchants.

  3. Embedded Tokenization: This guide explains how to properly tokenize cards in production via our embedded iframe.

Getting Started

Step 1: Create an Identity for a Merchant

curl https://api-test.payline.io/identities \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -d '
    {
        "tags": {
            "Studio Rating": "4.7"
        },
        "entity": {
            "last_name": "Sunkhronos",
            "max_transaction_amount": 12000000,
            "has_accepted_credit_cards_previously": true,
            "default_statement_descriptor": "Petes Coffee",
            "personal_address": {
                "city": "San Mateo",
                "country": "USA",
                "region": "CA",
                "line2": "Apartment 7",
                "line1": "741 Douglass St",
                "postal_code": "94114"
            },
            "incorporation_date": {
                "year": 1978,
                "day": 27,
                "month": 6
            },
            "business_address": {
                "city": "San Mateo",
                "country": "USA",
                "region": "CA",
                "line2": "Apartment 8",
                "line1": "741 Douglass St",
                "postal_code": "94114"
            },
            "ownership_type": "PRIVATE",
            "first_name": "dwayne",
            "title": "CEO",
            "business_tax_id": "123456789",
            "doing_business_as": "Petes Coffee",
            "principal_percentage_ownership": 50,
            "email": "user@example.org",
            "mcc": "0742",
            "phone": "1234567890",
            "business_name": "Petes Coffee",
            "tax_id": "123456789",
            "business_type": "INDIVIDUAL_SOLE_PROPRIETORSHIP",
            "business_phone": "+1 (408) 756-4497",
            "dob": {
                "year": 1978,
                "day": 27,
                "month": 6
            },
            "url": "www.PetesCoffee.com",
            "annual_card_volume": 12000000
        }
    }'

import io.payline.payments.ApiClient;
import io.payline.payments.enums.BusinessType;
import io.payline.payments.forms.Address;
import io.payline.payments.forms.Date;
import io.payline.payments.forms.IdentityEntityForm;
import io.payline.payments.forms.IdentityForm;
import io.payline.payments.interfaces.ApiError;
import io.payline.payments.interfaces.Maybe;
import io.payline.payments.views.Identity;


IdentityForm form = IdentityForm.builder()
  .entity(IdentityEntityForm.builder()
  .firstName("dwayne")
  .lastName("Sunkhronos")
  .email("user@example.org")
  .businessName("business inc")
  .businessType(BusinessType.LIMITED_LIABILITY_COMPANY)
  .doingBusinessAs("doingBusinessAs")
  .phone("1234567890")
  .businessPhone("+1 (408) 756-4497")
  .taxId("123456789")
  .businessTaxId("123456789")
  .personalAddress(Address.builder()
  .line1("741 Douglass St")
  .line2("Apartment 7")
  .city("San Mateo")
  .region("CA")
  .postalCode("94114")
  .country("USA")
  .build())
  .businessAddress(Address.builder()
  .line1("741 Douglass St")
  .line2("Apartment 7")
  .city("San Mateo")
  .region("CA")
  .postalCode("94114")
  .country("USA")
  .build())
  .dob(Date.builder().day(Integer.valueOf(27)).month(Integer.valueOf(5)).year(Integer.valueOf(1978)).build())
  .maxTransactionAmount(Long.valueOf(1000L))
  .mcc("7399").url("http://sample-entity.com")
  .annualCardVolume(Long.valueOf(100L))
  .defaultStatementDescriptor("Business Inc")
  .incorporationDate(Date.builder().day(Integer.valueOf(1)).month(Integer.valueOf(12)).year(Integer.valueOf(2012)).build())
  .principalPercentageOwnership(Integer.valueOf(51)).build()).build();

Maybe<Identity> response = api.identities.post(form);
if(! response.succeeded().booleanValue()) {
    ApiError error = response.error();
    System.out.println(error.getCode());
    throw new RuntimeException("API error attempting to create Identity");
}
    Identity identity = (Identity)response.view();
    identity.getId();

<?php
use Payline\Resources\Identity;

$identity = new Identity(
    array(
        "tags"=> array(
            "Studio Rating"=> "4.7"
        ),
        "entity"=> array(
            "last_name"=> "Sunkhronos",
            "max_transaction_amount"=> 12000000,
            "has_accepted_credit_cards_previously"=> true,
            "default_statement_descriptor"=> "Petes Coffee",
            "personal_address"=> array(
                "city"=> "San Mateo",
                "country"=> "USA",
                "region"=> "CA",
                "line2"=> "Apartment 7",
                "line1"=> "741 Douglass St",
                "postal_code"=> "94114"
            ),
            "incorporation_date"=> array(
                "year"=> 1978,
                "day"=> 27,
                "month"=> 6
            ),
            "business_address"=> array(
                "city"=> "San Mateo",
                "country"=> "USA",
                "region"=> "CA",
                "line2"=> "Apartment 8",
                "line1"=> "741 Douglass St",
                "postal_code"=> "94114"
            ),
            "ownership_type"=> "PRIVATE",
            "first_name"=> "dwayne",
            "title"=> "CEO",
            "business_tax_id"=> "123456789",
            "doing_business_as"=> "Petes Coffee",
            "principal_percentage_ownership"=> 50,
            "email"=> "user@example.org",
            "mcc"=> "0742",
            "phone"=> "1234567890",
            "business_name"=> "Petes Coffee",
            "tax_id"=> "123456789",
            "business_type"=> "INDIVIDUAL_SOLE_PROPRIETORSHIP",
            "business_phone"=> "+1 (408) 756-4497",
            "dob"=> array(
                "year"=> 1978,
                "day"=> 27,
                "month"=> 6
            ),
            "url"=> "www.PetesCoffee.com",
            "annual_card_volume"=> 12000000
        )
    )
);
$identity = $identity->save();



from payline.resources import Identity

identity = Identity(**
    {
        "tags": {
            "Studio Rating": "4.7"
        },
        "entity": {
            "last_name": "Sunkhronos",
            "max_transaction_amount": 12000000,
            "has_accepted_credit_cards_previously": True,
            "default_statement_descriptor": "Petes Coffee",
            "personal_address": {
                "city": "San Mateo",
                "country": "USA",
                "region": "CA",
                "line2": "Apartment 7",
                "line1": "741 Douglass St",
                "postal_code": "94114"
            },
            "incorporation_date": {
                "year": 1978,
                "day": 27,
                "month": 6
            },
            "business_address": {
                "city": "San Mateo",
                "country": "USA",
                "region": "CA",
                "line2": "Apartment 8",
                "line1": "741 Douglass St",
                "postal_code": "94114"
            },
            "ownership_type": "PRIVATE",
            "first_name": "dwayne",
            "title": "CEO",
            "business_tax_id": "123456789",
            "doing_business_as": "Petes Coffee",
            "principal_percentage_ownership": 50,
            "email": "user@example.org",
            "mcc": "0742",
            "phone": "1234567890",
            "business_name": "Petes Coffee",
            "tax_id": "123456789",
            "business_type": "INDIVIDUAL_SOLE_PROPRIETORSHIP",
            "business_phone": "+1 (408) 756-4497",
            "dob": {
                "year": 1978,
                "day": 27,
                "month": 6
            },
            "url": "www.PetesCoffee.com",
            "annual_card_volume": 12000000
        }
    }).save()

identity = Payline::Identity.new(
    {
        "tags"=> {
            "Studio Rating"=> "4.7"
        },
        "entity"=> {
            "last_name"=> "Sunkhronos",
            "max_transaction_amount"=> 12000000,
            "has_accepted_credit_cards_previously"=> true,
            "default_statement_descriptor"=> "Petes Coffee",
            "personal_address"=> {
                "city"=> "San Mateo",
                "country"=> "USA",
                "region"=> "CA",
                "line2"=> "Apartment 7",
                "line1"=> "741 Douglass St",
                "postal_code"=> "94114"
            },
            "incorporation_date"=> {
                "year"=> 1978,
                "day"=> 27,
                "month"=> 6
            },
            "business_address"=> {
                "city"=> "San Mateo",
                "country"=> "USA",
                "region"=> "CA",
                "line2"=> "Apartment 8",
                "line1"=> "741 Douglass St",
                "postal_code"=> "94114"
            },
            "ownership_type"=> "PRIVATE",
            "first_name"=> "dwayne",
            "title"=> "CEO",
            "business_tax_id"=> "123456789",
            "doing_business_as"=> "Petes Coffee",
            "principal_percentage_ownership"=> 50,
            "email"=> "user@example.org",
            "mcc"=> "0742",
            "phone"=> "1234567890",
            "business_name"=> "Petes Coffee",
            "tax_id"=> "123456789",
            "business_type"=> "INDIVIDUAL_SOLE_PROPRIETORSHIP",
            "business_phone"=> "+1 (408) 756-4497",
            "dob"=> {
                "year"=> 1978,
                "day"=> 27,
                "month"=> 6
            },
            "url"=> "www.PetesCoffee.com",
            "annual_card_volume"=> 12000000
        }
    }).save

Example Response:

{
  "id" : "IDteVu9cMtNfZmeTr4pgaDeU",
  "entity" : {
    "title" : "CEO",
    "first_name" : "dwayne",
    "last_name" : "Sunkhronos",
    "email" : "user@example.org",
    "business_name" : "Petes Coffee",
    "business_type" : "INDIVIDUAL_SOLE_PROPRIETORSHIP",
    "doing_business_as" : "Petes Coffee",
    "phone" : "1234567890",
    "business_phone" : "+1 (408) 756-4497",
    "personal_address" : {
      "line1" : "741 Douglass St",
      "line2" : "Apartment 7",
      "city" : "San Mateo",
      "region" : "CA",
      "postal_code" : "94114",
      "country" : "USA"
    },
    "business_address" : {
      "line1" : "741 Douglass St",
      "line2" : "Apartment 8",
      "city" : "San Mateo",
      "region" : "CA",
      "postal_code" : "94114",
      "country" : "USA"
    },
    "mcc" : "0742",
    "dob" : {
      "day" : 27,
      "month" : 6,
      "year" : 1978
    },
    "max_transaction_amount" : 12000000,
    "amex_mid" : null,
    "discover_mid" : null,
    "url" : "www.PetesCoffee.com",
    "annual_card_volume" : 12000000,
    "has_accepted_credit_cards_previously" : true,
    "incorporation_date" : {
      "day" : 27,
      "month" : 6,
      "year" : 1978
    },
    "principal_percentage_ownership" : 50,
    "short_business_name" : null,
    "ownership_type" : "PRIVATE",
    "tax_id_provided" : true,
    "business_tax_id_provided" : true,
    "default_statement_descriptor" : "Petes Coffee"
  },
  "tags" : {
    "Studio Rating" : "4.7"
  },
  "created_at" : "2017-10-12T01:05:39.66Z",
  "updated_at" : "2017-10-12T01:05:39.66Z",
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
    },
    "verifications" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/verifications"
    },
    "merchants" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/merchants"
    },
    "settlements" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/settlements"
    },
    "authorizations" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/authorizations"
    },
    "transfers" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/transfers"
    },
    "payment_instruments" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/payment_instruments"
    },
    "disputes" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/disputes"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    }
  }
}

Before we can begin charging cards we’ll need to provision a Merchant account for your seller. This requires 3-steps, which we’ll go into greater detail in the next few sections:

  1. First, create an Identity resource with the merchant’s underwriting and identity verification information

    POST https://api-test.payline.io/identities/

  2. Second, create a Payment Instrument representing the merchant’s bank account where processed funds will be settled (i.e. deposited)

    POST https://api-test.payline.io/payment_instruments/

  3. Finally, provision the Merchant account

    POST https://api-test.payline.io/identities/:IDENTITY_ID/merchants

Let’s start with the first step by creating an Identity resource. Each Identity represents either a person or a business. We use this resource to associate cards and payouts. This structure makes it simple to manage and reconcile payment instruments and payout history. Accounting of funds is done using the Identity so it’s recommended to have an Identity per recipient of funds. Additionally, the Identity resource is optionally used to collect KYC information.

You’ll want to store the ID of the newly created Identity resource for reference later.

HTTP Request

POST https://api-test.payline.io/identities

Business-specific Request Arguments

Field Type Description
business_name string, required Merchant’s full legal business name (If INDIVIDUAL_SOLE_PROPRIETORSHIP, please input first name, Full legal last name and middle initial; max 120 characters)
doing_business_as string, required Alternate name of the business. If no other name is used please use the same value for business_name (max 60 characters)
business_type string, required Please select one of the following values: INDIVIDUAL_SOLE_PROPRIETORSHIP, CORPORATION, LIMITED_LIABILITY_COMPANY, PARTNERSHIP, ASSOCIATION_ESTATE_TRUST, TAX_EXEMPT_ORGANIZATION, INTERNATIONAL_ORGANIZATION, GOVERNMENT_AGENCY
business_tax_id string, required Nine digit Tax Identification Number (TIN), Employer Identification Number (EIN) or if the business_type is INDIVIDUAL_SOLE_PROPRIETORSHIP and a Tax ID is not available, the principal’s Social Security Number (SSN)
url string, required Merchant’s publicly available website (max 100 characters)
business_phone string, required Customer service phone number where the merchant can be reached (max 10 characters)
incorporation_date object, required Date company was founded (See below for a full list of the child attributes)
business_address object, required Primary address for the legal entity (Full description of child attributes below)
ownership_type string, required Values can be either PUBLIC to indicate a publicly traded company or PRIVATE for privately held businesses

Principal-specific Request Arguments

(i.e. authorized representative or primary contact responsible for the account)

Field Type Description
first_name string, required Full legal first name of the merchant’s principal representative (max 20 characters)
last_name string, required Full legal last name of the merchant’s principal representative (max 20 characters)
title string, required Principal’s corporate title or role (i.e. Chief Executive Officer, CFO, etc.; max 60 characters)
principal_percentage_ownership integer, required Percentage of company owned by the principal (min 0; max 100)
tax_id string, required Nine digit Social Security Number (SSN) for the principal
dob object, required Principal’s date of birth (Full description of child attributes below)
phone string, required Principal’s phone number (max 10 characters)
email string, required Principal’s email address where they can be reached (max 100 characters)
personal_address object, required Principal’s personal home address. This field is used for identity verification purposes (Full description of child attributes below)

Processing-specific Request Arguments

Field Type Description
default_statement_descriptor string, required Billing descriptor displayed on the buyer’s bank or card statement (Length must be between 1 and 20 characters)
annual_card_volume integer, required Approximate annual credit card sales expected to be processed in cents by this merchant (max 23 characters)
max_transaction_amount integer, required Maximum amount that can be transacted for a single transaction in cents (max 12 characters)
mcc string, required Merchant Category Code (MCC) that this merchant will be classified under
has_accepted_credit_cards_previously boolean, optional Defaults to false if not passed

Address-object Request Arguments

Field Type Description
line1 string, required First line of the address (max 60 characters)
line2 string, optional Second line of the address (max 60 characters)
city string, required City (max 20 characters)
region string, required 2-letter State code
postal_code string, required Zip or Postal code (max 7 characters)
country string, required 3-Letter Country code

Incorporation Date-object Request Arguments

Field Type Description
day integer, required Day business was incorporated (between 1 and 31)
month integer, required Month business was incorporated (between 1 and 12)
year integer, required Year business was incorporated (4-digit)

DOB-object Request Arguments

Field Type Description
day integer, required Day of birth (between 1 and 31)
month integer, required Month of birth (between 1 and 12)
year integer, required Year of birth (4-digit)

Step 2: Tokenize a Bank Account for Funding your Merchant

curl https://api-test.payline.io/payment_instruments \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -d '
    {
        "account_type": "SAVINGS",
        "name": "Fran Lemke",
        "tags": {
            "Bank Account": "Company Account"
        },
        "country": "USA",
        "bank_code": "123123123",
        "account_number": "123123123",
        "type": "BANK_ACCOUNT",
        "identity": "IDteVu9cMtNfZmeTr4pgaDeU"
    }'


import io.payline.payments.ApiClient;
import io.payline.payments.enums.BankAccountType;
import io.payline.payments.forms.BankAccountForm;
import io.payline.payments.interfaces.ApiError;
import io.payline.payments.interfaces.Maybe;
import io.payline.payments.views.BankAccount;
import io.payline.payments.views.Identity;
import java.util.Currency;

BankAccountForm form = BankAccountForm.builder()
        .name("Joe Doe")
        .identity("IDteVu9cMtNfZmeTr4pgaDeU")
        .accountNumber("84012312415")
        .bankCode("840123124")
        .accountType(BankAccountType.SAVINGS)
        .companyName("company name")
        .country("USA")
        .currency(Currency.getInstance("USD"))
        .build();

Maybe<BankAccount> request = api.instruments.post(form);

if (! request.succeeded()) {
    ApiError error = request.error();
    System.out.println(error);
    throw new RuntimeException("API error attempting to create bank account");
}
BankAccount bankAccount = request.view();

<?php
use Payline\Resources\Identity;
use Payline\Resources\BankAccount;

$identity = Identity::retrieve('IDteVu9cMtNfZmeTr4pgaDeU');
$bank_account = new BankAccount(
    array(
        "account_type"=> "SAVINGS",
        "name"=> "Fran Lemke",
        "tags"=> array(
            "Bank Account"=> "Company Account"
        ),
        "country"=> "USA",
        "bank_code"=> "123123123",
        "account_number"=> "123123123",
        "type"=> "BANK_ACCOUNT",
        "identity"=> "IDteVu9cMtNfZmeTr4pgaDeU"
    ));
$bank_account = $identity->createBankAccount($bank_account);


from payline.resources import BankAccount

bank_account = BankAccount(**
    {
        "account_type": "SAVINGS",
        "name": "Fran Lemke",
        "tags": {
            "Bank Account": "Company Account"
        },
        "country": "USA",
        "bank_code": "123123123",
        "account_number": "123123123",
        "type": "BANK_ACCOUNT",
        "identity": "IDteVu9cMtNfZmeTr4pgaDeU"
    }).save()

bank_account = Payline::BankAccount.new(
    {
        "account_type"=> "SAVINGS",
        "name"=> "Fran Lemke",
        "tags"=> {
            "Bank Account"=> "Company Account"
        },
        "country"=> "USA",
        "bank_code"=> "123123123",
        "account_number"=> "123123123",
        "type"=> "BANK_ACCOUNT",
        "identity"=> "IDteVu9cMtNfZmeTr4pgaDeU"
    }).save

Example Response:

{
  "id" : "PI86ok97GjDkWrkKXAJ7kdQs",
  "fingerprint" : "FPR-1215770130",
  "tags" : {
    "Bank Account" : "Company Account"
  },
  "bank_code" : "123123123",
  "country" : "USA",
  "masked_account_number" : "XXXXX3123",
  "name" : "Fran Lemke",
  "account_type" : "SAVINGS",
  "created_at" : "2017-10-12T01:05:48.95Z",
  "updated_at" : "2017-10-12T01:05:48.95Z",
  "instrument_type" : "BANK_ACCOUNT",
  "type" : "BANK_ACCOUNT",
  "currency" : "USD",
  "identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PI86ok97GjDkWrkKXAJ7kdQs"
    },
    "authorizations" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PI86ok97GjDkWrkKXAJ7kdQs/authorizations"
    },
    "identity" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
    },
    "transfers" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PI86ok97GjDkWrkKXAJ7kdQs/transfers"
    },
    "verifications" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PI86ok97GjDkWrkKXAJ7kdQs/verifications"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    }
  }
}

Now that we’ve created an Identity for our merchant, we’ll need to add a bank account where funds will be disbursed (i.e. their funding account).

In the API, bank accounts – as well as credit cards – are represented by the Payment Instrument resource.

To classify the Payment Instrument as a bank account you’ll need to pass BANK_ACCOUNT in the type field of your request, and you’ll also want to pass the ID of the Identity that you created in the last step via the identity field to properly associate it with your merchant.

HTTP Request

POST https://api-test.payline.io/payment_instruments

Request Arguments

Field Type Description
account_number string, required Bank account number
bank_code string, required Bank routing number
type string, required Type of Payment Instrument (for bank accounts use BANK_ACCOUNT)
identity string, required ID for the Identity resource which the account is associated
account_type string, required Either CHECKING or SAVINGS
name string, required Account owner’s full name (max 40 characters)

Step 3: Provision Merchant Account

curl https://api-test.payline.io/identities/IDteVu9cMtNfZmeTr4pgaDeU/merchants \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -d '
    {
        "processor": null,
        "tags": {
            "key_2": "value_2"
        }
    }'
import io.payline.payments.processing.client.model.Merchant;

Merchant merchant = identity.provisionMerchantOn(Merchant.builder().build());

<?php
use Payline\Resources\Identity;
use Payline\Resources\Merchant;

$identity = Identity::retrieve('IDteVu9cMtNfZmeTr4pgaDeU');
$merchant = $identity->provisionMerchantOn(new Merchant());


from payline.resources import Identity
from payline.resources import Merchant

identity = Identity.get(id="IDteVu9cMtNfZmeTr4pgaDeU")
merchant = identity.provision_merchant_on(Merchant())
identity = Payline::Identity.retrieve(:id=>"IDteVu9cMtNfZmeTr4pgaDeU")

merchant = identity.provision_merchant

Example Response:

{
  "id" : "MUgv6PAeMd5FDgnFXYRT4RpM",
  "identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
  "verification" : "VI7CGMu5oZPVSdHdaVa3apfi",
  "merchant_profile" : "MP9ZDZqzGYQ5EULvbcVfmKYN",
  "processor" : "DUMMY_V1",
  "processing_enabled" : false,
  "settlement_enabled" : false,
  "tags" : { },
  "created_at" : "2017-10-12T01:05:50.98Z",
  "updated_at" : "2017-10-12T01:05:50.98Z",
  "onboarding_state" : "PROVISIONING",
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/merchants/MUgv6PAeMd5FDgnFXYRT4RpM"
    },
    "identity" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
    },
    "verifications" : {
      "href" : "https://api-test.payline.io:443/merchants/MUgv6PAeMd5FDgnFXYRT4RpM/verifications"
    },
    "merchant_profile" : {
      "href" : "https://api-test.payline.io:443/merchant_profiles/MP9ZDZqzGYQ5EULvbcVfmKYN"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    },
    "verification" : {
      "href" : "https://api-test.payline.io:443/verifications/VI7CGMu5oZPVSdHdaVa3apfi"
    }
  }
}

Now that we’ve associated a Payment Instrument with our seller’s Identity we’re ready to provision a Merchant account. This is the last step before you can begin processing on their behalf. Luckily you’ve already done most of the heavy lifting. Just make one final POST request, and you’ll be returned a Merchant resource. Take a second to inspect this newly created resource, particularly the onboarding_state, which can have 3 potential states that indicate its ability to process and settle funds:

  1. PROVISIONING: Request is pending (state will typically change after two minutes)

    • processing_enabled: False
    • settlement_enabled: False
  2. APPROVED: Merchant has been approved and can begin processing

    • processing_enabled: True
    • settlement_enabled: True
  3. REJECTED: Merchant was rejected by the processor either because the collected information was invalid or it failed one of a number of regulatory and/or compliance checks (e.g. KYC, OFAC or MATCH)

    • processing_enabled: False
    • settlement_enabled: False

HTTP Request

POST https://api-test.payline.io/identities/:IDENTITY_ID/merchants

URL Parameters

Parameter Description
:IDENTITY_ID ID of the Identity

Step 4: Create an Identity for a Buyer


curl https://api-test.payline.io/identities \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -d '
    {
        "tags": {
            "key": "value"
        },
        "entity": {
            "phone": "7145677613",
            "first_name": "Ayisha",
            "last_name": "Chang",
            "email": "therock@gmail.com",
            "personal_address": {
                "city": "San Mateo",
                "country": "USA",
                "region": "CA",
                "line2": "Apartment 7",
                "line1": "741 Douglass St",
                "postal_code": "94114"
            }
        }
    }'

import io.payline.payments.forms.*;
import io.payline.payments.views.*;
import io.payline.payments.forms.Address;
import io.payline.payments.interfaces.ApiError;
import io.payline.payments.interfaces.Maybe;
import io.payline.payments.forms.Date;


IdentityForm form = IdentityForm.builder()
    .entity(
    IdentityEntityForm.builder()
        .firstName("dwayne")
        .lastName("Sunkhronos")
        .email("user@example.org")
        .personalAddress(
            Address.builder()
                .line1("741 Douglass St")
                .line2("Apartment 7")
                .city("San Mateo")
                .region("CA")
                .postalCode("94114")
                .country("USA")
                .build()
        )
        .build())
      .build();

Maybe<Identity> response = api.identities.post(form);

if (! response.succeeded()) {
    ApiError error = response.error();
    System.out.println(error.getCode());
    throw new RuntimeException("API error attempting to create Identity");
}

Identity identity = response.view();

<?php
use Payline\Resources\Identity;

$identity = new Identity(
    array(
        "tags"=> array(
            "key"=> "value"
        ),
        "entity"=> array(
            "phone"=> "7145677613",
            "first_name"=> "Ayisha",
            "last_name"=> "Chang",
            "email"=> "therock@gmail.com",
            "personal_address"=> array(
                "city"=> "San Mateo",
                "country"=> "USA",
                "region"=> "CA",
                "line2"=> "Apartment 7",
                "line1"=> "741 Douglass St",
                "postal_code"=> "94114"
            )
        )
    ));
$identity = $identity->save();



from payline.resources import Identity

identity = Identity(**
    {
        "tags": {
            "key": "value"
        },
        "entity": {
            "phone": "7145677613",
            "first_name": "Ayisha",
            "last_name": "Chang",
            "email": "therock@gmail.com",
            "personal_address": {
                "city": "San Mateo",
                "country": "USA",
                "region": "CA",
                "line2": "Apartment 7",
                "line1": "741 Douglass St",
                "postal_code": "94114"
            }
        }
    }).save()

identity = Payline::Identity.new(
    {
        "tags"=> {
            "key"=> "value"
        },
        "entity"=> {
            "phone"=> "7145677613",
            "first_name"=> "Ayisha",
            "last_name"=> "Chang",
            "email"=> "therock@gmail.com",
            "personal_address"=> {
                "city"=> "San Mateo",
                "country"=> "USA",
                "region"=> "CA",
                "line2"=> "Apartment 7",
                "line1"=> "741 Douglass St",
                "postal_code"=> "94114"
            }
        }
    }).save

Example Response:

{
  "id" : "IDjDBhJFWm36i6SykV9wV2bP",
  "entity" : {
    "title" : null,
    "first_name" : "Ayisha",
    "last_name" : "Chang",
    "email" : "therock@gmail.com",
    "business_name" : null,
    "business_type" : null,
    "doing_business_as" : null,
    "phone" : "7145677613",
    "business_phone" : null,
    "personal_address" : {
      "line1" : "741 Douglass St",
      "line2" : "Apartment 7",
      "city" : "San Mateo",
      "region" : "CA",
      "postal_code" : "94114",
      "country" : "USA"
    },
    "business_address" : null,
    "mcc" : null,
    "dob" : null,
    "max_transaction_amount" : 0,
    "amex_mid" : null,
    "discover_mid" : null,
    "url" : null,
    "annual_card_volume" : 0,
    "has_accepted_credit_cards_previously" : false,
    "incorporation_date" : null,
    "principal_percentage_ownership" : null,
    "short_business_name" : null,
    "ownership_type" : null,
    "tax_id_provided" : false,
    "business_tax_id_provided" : false,
    "default_statement_descriptor" : null
  },
  "tags" : {
    "key" : "value"
  },
  "created_at" : "2017-10-12T01:05:52.31Z",
  "updated_at" : "2017-10-12T01:05:52.31Z",
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP"
    },
    "verifications" : {
      "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP/verifications"
    },
    "merchants" : {
      "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP/merchants"
    },
    "settlements" : {
      "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP/settlements"
    },
    "authorizations" : {
      "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP/authorizations"
    },
    "transfers" : {
      "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP/transfers"
    },
    "payment_instruments" : {
      "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP/payment_instruments"
    },
    "disputes" : {
      "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP/disputes"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    }
  }
}

Now that we have successfully provisioned a Merchant we’ll need to create an Identity that represents your buyer. Don’t worry though you won’t need to capture the same amount of information from your buyer. So long as you don’t pass a business_type field all the fields are optional.

Typically, we suggest at least collecting the buyer’s name and email to help with accounting, reconciliation, and chargebacks.

HTTP Request

POST https://api-test.payline.io/identities

Request Arguments

Field Type Description
first_name string, optional First name
last_name string, optional Last name
email string, optional Email
phone string, optional Phone number
tags object, optional Key value pair for annotating custom meta data (e.g. order numbers)
personal_address object, optional Customers shipping address or billing address (Full description of child attributes below)

Address-object Request Arguments

Field Type Description
line1 string, required First line of the address (max 60 characters)
line2 string, optional Second line of the address (max 60 characters)
city string, required City (max 20 characters)
region string, required 2-letter State code
postal_code string, required Zip or Postal code (max 7 characters)
country string, required 3-Letter Country code

Step 5: Tokenize a Card



curl https://api-test.payline.io/payment_instruments \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -d '
    {
        "name": "Fran Le",
        "expiration_year": 2020,
        "tags": {
            "card_name": "Business Card"
        },
        "number": "4957030420210454",
        "expiration_month": 12,
        "address": {
            "city": "San Mateo",
            "country": "USA",
            "region": "CA",
            "line2": "Apartment 7",
            "line1": "741 Douglass St",
            "postal_code": "94114"
        },
        "security_code": "112",
        "type": "PAYMENT_CARD",
        "identity": "IDjDBhJFWm36i6SykV9wV2bP"
    }'


import io.payline.payments.forms.*;
import io.payline.payments.views.*;
import io.payline.payments.forms.Address;
import io.payline.payments.interfaces.ApiError;
import io.payline.payments.interfaces.Maybe;
import com.google.common.collect.ImmutableMap;

PaymentCardForm form = PaymentCardForm.builder()
        .name("Joe Doe")
        .number("4957030420210454")
        .securityCode("112")
        .expirationYear(2020)
        .identity("IDteVu9cMtNfZmeTr4pgaDeU")
        .expirationMonth(12)
        .address(
                Address.builder()
                        .city("San Mateo")
                        .country("USA")
                        .region("CA")
                        .line1("123 Fake St")
                        .line2("#7")
                        .postalCode("90210")
                        .build()
        )
        .tags(ImmutableMap.of("card_name", "Business Card"))
        .build();

Maybe<PaymentCard> response = api.instruments.post(form);
        if (! response.succeeded()) {
            ApiError error = response .error();
            System.out.println(error.getCode());
            throw new RuntimeException("API error attempting to create Payment Card");
        }
PaymentCard card = response.view();

<?php
use Payline\Resources\PaymentCard;
use Payline\Resources\Identity;

$identity = Identity::retrieve('IDteVu9cMtNfZmeTr4pgaDeU');
$card = new PaymentCard(
    array(
        "name"=> "Fran Le",
        "expiration_year"=> 2020,
        "tags"=> array(
            "card_name"=> "Business Card"
        ),
        "number"=> "4957030420210454",
        "expiration_month"=> 12,
        "address"=> array(
            "city"=> "San Mateo",
            "country"=> "USA",
            "region"=> "CA",
            "line2"=> "Apartment 7",
            "line1"=> "741 Douglass St",
            "postal_code"=> "94114"
        ),
        "security_code"=> "112",
        "type"=> "PAYMENT_CARD",
        "identity"=> "IDjDBhJFWm36i6SykV9wV2bP"
    ));
$card = $identity->createPaymentCard($card);



from payline.resources import PaymentCard

card = PaymentCard(**
    {
        "name": "Fran Le",
        "expiration_year": 2020,
        "tags": {
            "card_name": "Business Card"
        },
        "number": "4957030420210454",
        "expiration_month": 12,
        "address": {
            "city": "San Mateo",
            "country": "USA",
            "region": "CA",
            "line2": "Apartment 7",
            "line1": "741 Douglass St",
            "postal_code": "94114"
        },
        "security_code": "112",
        "type": "PAYMENT_CARD",
        "identity": "IDjDBhJFWm36i6SykV9wV2bP"
    }).save()
card = Payline::PaymentCard.new(
    {
        "name"=> "Fran Le",
        "expiration_year"=> 2020,
        "tags"=> {
            "card_name"=> "Business Card"
        },
        "number"=> "4957030420210454",
        "expiration_month"=> 12,
        "address"=> {
            "city"=> "San Mateo",
            "country"=> "USA",
            "region"=> "CA",
            "line2"=> "Apartment 7",
            "line1"=> "741 Douglass St",
            "postal_code"=> "94114"
        },
        "security_code"=> "112",
        "type"=> "PAYMENT_CARD",
        "identity"=> "IDjDBhJFWm36i6SykV9wV2bP"
    }).save

Example Response:

{
  "id" : "PImmK4gYPPe7QYyqC5n9BCCo",
  "fingerprint" : "FPR-749935287",
  "tags" : {
    "card_name" : "Business Card"
  },
  "expiration_month" : 12,
  "expiration_year" : 2020,
  "last_four" : "0454",
  "brand" : "VISA",
  "card_type" : "UNKNOWN",
  "name" : "Fran Le",
  "address" : {
    "line1" : "741 Douglass St",
    "line2" : "Apartment 7",
    "city" : "San Mateo",
    "region" : "CA",
    "postal_code" : "94114",
    "country" : "USA"
  },
  "address_verification" : "UNKNOWN",
  "security_code_verification" : "UNKNOWN",
  "created_at" : "2017-10-12T01:05:53.88Z",
  "updated_at" : "2017-10-12T01:05:53.88Z",
  "instrument_type" : "PAYMENT_CARD",
  "type" : "PAYMENT_CARD",
  "currency" : "USD",
  "identity" : "IDjDBhJFWm36i6SykV9wV2bP",
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PImmK4gYPPe7QYyqC5n9BCCo"
    },
    "authorizations" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PImmK4gYPPe7QYyqC5n9BCCo/authorizations"
    },
    "identity" : {
      "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP"
    },
    "transfers" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PImmK4gYPPe7QYyqC5n9BCCo/transfers"
    },
    "verifications" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PImmK4gYPPe7QYyqC5n9BCCo/verifications"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    },
    "updates" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PImmK4gYPPe7QYyqC5n9BCCo/updates"
    }
  }
}

Now that we have an Identity resource representing our buyer, we’ll need to create a Payment Instrument which represents the credit card you’ll be debiting (i.e. charging).

You’ll also need to interpolate your own buyer’s Identity ID from the previous request to properly associate it.

Please review our guide on how to tokenize cards via the embedded tokenization form

HTTP Request

POST https://api-test.payline.io/payment_instruments

Request Arguments

Field Type Description
identity string, required ID of the Identity that the card should be associated
type string, required Type of Payment Instrument (for cards input PAYMENT_CARD)
number string, required Credit card account number
security_code string, optional The 3-4 digit security code for the card (i.e. CVV code)
expiration_month integer, required Expiration month (e.g. 12 for December)
expiration_year integer, required 4-digit expiration year
name string, optional Full name of the registered card holder
address object, optional Billing address (Full description of child attributes below)

Address-object Request Arguments

Field Type Description
line1 string, required First line of the address (max 60 characters)
line2 string, optional Second line of the address (max 60 characters)
city string, required City (max 20 characters)
region string, required 2-letter State code
postal_code string, required Zip or Postal code (max 7 characters)
country string, required 3-Letter Country code

Step 6: Create an Authorization

curl https://api-test.payline.io/authorizations \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -d '
    {
        "merchant_identity": "IDteVu9cMtNfZmeTr4pgaDeU",
        "currency": "USD",
        "amount": 100,
        "source": "PImmK4gYPPe7QYyqC5n9BCCo",
        "tags": {
            "order_number": "21DFASJSAKAS"
        }
    }'

import io.payline.payments.ApiClient;
import io.payline.payments.forms.*;
import io.payline.payments.views.*;
import io.payline.payments.interfaces.ApiError;
import io.payline.payments.interfaces.Maybe;

AuthorizationCreateForm formCreateAuthorization = AuthorizationCreateForm.builder()
    .amount(10000L)
    .merchantIdentity("IDteVu9cMtNfZmeTr4pgaDeU")
    .source("PImmK4gYPPe7QYyqC5n9BCCo")
    .build();

Maybe<Authorization> response = api.authorizations.post(formCreateAuthorization);

if (! response.succeeded()) {
  ApiError error = response.error();
  System.out.println(error.getMessage());
  throw new RuntimeException("API error attempting to creating Authorization");
}

Authorization authorization = response.view();

<?php
use Payline\Resources\Authorization;

$authorization = new Authorization(
    array(
        "merchant_identity"=> "IDteVu9cMtNfZmeTr4pgaDeU",
        "currency"=> "USD",
        "amount"=> 100,
        "source"=> "PImmK4gYPPe7QYyqC5n9BCCo",
        "tags"=> array(
            "order_number"=> "21DFASJSAKAS"
        )
    ));
$authorization = $authorization->save();



from payline.resources import Authorization
authorization = Authorization(**
    {
        "merchant_identity": "IDteVu9cMtNfZmeTr4pgaDeU",
        "currency": "USD",
        "amount": 100,
        "source": "PImmK4gYPPe7QYyqC5n9BCCo",
        "tags": {
            "order_number": "21DFASJSAKAS"
        }
    }).save()

authorization = Payline::Authorization.new(
    {
        "merchant_identity"=> "IDteVu9cMtNfZmeTr4pgaDeU",
        "currency"=> "USD",
        "amount"=> 100,
        "source"=> "PImmK4gYPPe7QYyqC5n9BCCo",
        "tags"=> {
            "order_number"=> "21DFASJSAKAS"
        }
    }).save

Example Response:

{
  "id" : "AUk2C1ctLqeZbkiRJGZhrwxw",
  "amount" : 100,
  "tags" : {
    "order_number" : "21DFASJSAKAS"
  },
  "state" : "SUCCEEDED",
  "currency" : "USD",
  "transfer" : null,
  "messages" : [ ],
  "raw" : null,
  "created_at" : "2017-10-12T01:06:04.23Z",
  "updated_at" : "2017-10-12T01:06:04.27Z",
  "trace_id" : "2ff94b68-09bb-42dc-9f9e-76f4f845a874",
  "source" : "PImmK4gYPPe7QYyqC5n9BCCo",
  "merchant_identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
  "is_void" : false,
  "expires_at" : "2017-10-19T01:06:04.23Z",
  "idempotency_id" : null,
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/authorizations/AUk2C1ctLqeZbkiRJGZhrwxw"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    },
    "merchant_identity" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
    }
  }
}

At this point we’ve created resources representing the merchant, the buyer, and the buyer’s card.

Next you’ll need to create an Authorization. What’s a Authorization? Glad you asked! An Authorization (also known as a card hold) reserves a specific amount on a card to be captured (i.e. debited) at a later point, usually within 7 days. When an Authorization is captured it produces a Transfer resource.

To create an Authorization we’ll supply the buyer’s Payment Instrument ID as the source field and the seller’s Identity ID in the merchant_identity field. Note that the amount field is in cents.

Simple enough, right? You’ll also want to store the ID from that Authorization for your records so that we can capture those funds in the next step.

Authorizations have two possible states SUCCEEDED and FAILED. If the Authorization has succeeded, it must be captured before the expires_at or the funds will be released.

HTTP Request

POST https://api-test.payline.io/authorizations

Request Arguments

Field Type Description
source string, required The buyer’s Payment Instrument ID that you will be performing the authorization
merchant_identity string, required The ID of the Identity for the merchant that you are transacting on behalf of
amount integer, required The amount of the authorization in cents
currency string, required 3-letter ISO code designating the currency (e.g. USD)
tags object, optional Key value pair for annotating custom meta data (e.g. order numbers)

Step 7: Capture the Authorization

curl https://api-test.payline.io/authorizations/AUk2C1ctLqeZbkiRJGZhrwxw \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -X PUT \
    -d '
    {
        "fee": "10",
        "capture_amount": 100
    }'
import io.payline.payments.ApiClient;
import io.payline.payments.forms.*;
import io.payline.payments.views.*;
import io.payline.payments.interfaces.ApiError;
import io.payline.payments.interfaces.Maybe;

AuthorizationUpdateForm form = AuthorizationUpdateForm.builder()
    .captureAmount(100L)
    .fee(10L)
    .statementDescriptor("Order 123")
    .build();

Maybe<Authorization> response = api.authorizations.id("AUk2C1ctLqeZbkiRJGZhrwxw").put(form);

if (! response.succeeded()) {
    ApiError error = response.error();
    System.out.println(error.getMessage());
    throw new RuntimeException("API error attempting to capture authorization");
}
Authorization capturedAuthorization = response.view();

<?php
use Payline\Resources\Authorization;

$authorization = Authorization::retrieve('AUk2C1ctLqeZbkiRJGZhrwxw');
$authorization = $authorization->capture(50, 10);



from payline.resources import Authorization

authorization = Authorization.get(id="AUk2C1ctLqeZbkiRJGZhrwxw")
authorization.capture(**
    {
        "fee": "10",
        "capture_amount": 100
    })

authorization = Payline::Authorization.retrieve(:id=>"AUk2C1ctLqeZbkiRJGZhrwxw")
authorization = authorization.capture(
    {
        "fee"=> "10",
        "capture_amount"=> 100
    })



Example Response:

{
  "id" : "AUk2C1ctLqeZbkiRJGZhrwxw",
  "amount" : 100,
  "tags" : {
    "order_number" : "21DFASJSAKAS"
  },
  "state" : "SUCCEEDED",
  "currency" : "USD",
  "transfer" : "TR4Bgv1VHDePfYZdpUfUv9z6",
  "messages" : [ ],
  "raw" : null,
  "created_at" : "2017-10-12T01:06:04.16Z",
  "updated_at" : "2017-10-12T01:06:06.42Z",
  "trace_id" : "2ff94b68-09bb-42dc-9f9e-76f4f845a874",
  "source" : "PImmK4gYPPe7QYyqC5n9BCCo",
  "merchant_identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
  "is_void" : false,
  "expires_at" : "2017-10-19T01:06:04.16Z",
  "idempotency_id" : null,
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/authorizations/AUk2C1ctLqeZbkiRJGZhrwxw"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    },
    "transfer" : {
      "href" : "https://api-test.payline.io:443/transfers/TR4Bgv1VHDePfYZdpUfUv9z6"
    },
    "merchant_identity" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
    }
  }
}

Now that we have the funds held on a card, we’ll need to capture them. Failing to do so will result in the funds being released (i.e. returned) to the buyer.

Note you can capture any amount less than or equal to the amount of the original Authorization. You will also want to pass a fee. The fee field is the amount in cents you would like to keep before settling out to the merchant. For example, if you’re charging the buyer $100 on behalf of your merchant, and you’re taking a 10% service fee you’ll want to pass 1000 as the fee. This way when the funds are eventually settled out only $90 will be disbursed to your merchant.

Once successfully captured the transfer field of the Authorization will contain the ID for the corresponding Transfer resource. By default, Transfers will be in a PENDING state. PENDING means that the system hasn’t submitted the capture request as they are submitted via batch request. Once submited the state of the Transfer will update to SUCCEEDED.

Next we’re going to show you how to settle out the funds to your merchant.

HTTP Request

PUT https://api-test.payline.io/authorizations/:AUTHORIZATION_ID

URL Parameters

Parameter Description
:AUTHORIZATION_ID ID of the Authorization

Request Arguments

Field Type Description
capture_amount integer, required The amount of the Authorization you would like to capture in cents. Must be less than or equal to the amount of the Authorization
fee integer, optional Amount of the captured Authorization you would like to collect as your fee. Must be less than or equal to the amount

Step 8: Create a Batch Settlement

curl https://api-test.payline.io/identities/IDteVu9cMtNfZmeTr4pgaDeU/settlements \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -d '
    {
        "currency": "USD",
        "tags": {
            "Internal Daily Settlement ID": "21DFASJSAKAS"
        }
    }'

import io.payline.payments.ApiClient;
import io.payline.payments.forms.SettlementForm;
import io.payline.payments.interfaces.Maybe;
import io.payline.payments.views.*;
import java.util.Currency;


Settlement settlement = identity.createSettlement(
  Settlement.builder()
    .currency("USD")
    .build()
);

SettlementForm formSettlement = SettlementForm.builder()
    .currency(Currency.getInstance("USD"))
    .build();

Transfer transfer = api.transfers.id("AUk2C1ctLqeZbkiRJGZhrwxw").get().view();

Maybe<Settlement> response = api.identities.id("IDteVu9cMtNfZmeTr4pgaDeU").settlements.post(formSettlement);

if (! response.succeeded()) {
    throw new RuntimeException("API error attempting to create batch settlement");
}

Settlement settlementBatch = response.view();

<?php
use Payline\Resources\Identity;
use Payline\Resources\Settlement;

$identity = Identity::retrieve('IDteVu9cMtNfZmeTr4pgaDeU');
$settlement = new Settlement(
    array(
        "currency"=> "USD",
        "tags"=> array(
            "Internal Daily Settlement ID"=> "21DFASJSAKAS"
        )
    ));
$settlement = $identity->createSettlement($settlement);



from payline.resources import Identity
from payline.resources import Settlement

identity = Identity.get(id="IDteVu9cMtNfZmeTr4pgaDeU")
settlement = Settlement(**
    {
        "currency": "USD",
        "tags": {
            "Internal Daily Settlement ID": "21DFASJSAKAS"
        }
    })
identity.create_settlement(settlement)
identity = Payline::Identity.retrieve(:id=>"IDteVu9cMtNfZmeTr4pgaDeU")
settlement = identity.create_settlement(
    {
        "currency"=> "USD",
        "tags"=> {
            "Internal Daily Settlement ID"=> "21DFASJSAKAS"
        }
    })

Example Response:

{
  "id" : "STt3KJN4k1f9jCgJuJvZxVF7",
  "tags" : {
    "Internal Daily Settlement ID" : "21DFASJSAKAS"
  },
  "identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
  "currency" : "USD",
  "created_at" : "2017-10-12T01:08:56.90Z",
  "updated_at" : "2017-10-12T01:08:56.92Z",
  "processor" : "DUMMY_V1",
  "total_amount" : 720979,
  "total_fees" : 72101,
  "total_fee" : 72101,
  "net_amount" : 648878,
  "destination" : null,
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/settlements/STt3KJN4k1f9jCgJuJvZxVF7"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    },
    "identity" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
    },
    "funding_transfers" : {
      "href" : "https://api-test.payline.io:443/settlements/STt3KJN4k1f9jCgJuJvZxVF7/funding_transfers"
    },
    "transfers" : {
      "href" : "https://api-test.payline.io:443/settlements/STt3KJN4k1f9jCgJuJvZxVF7/transfers"
    },
    "fees" : {
      "href" : "https://api-test.payline.io:443/settlements/STt3KJN4k1f9jCgJuJvZxVF7/transfers?type=fee"
    },
    "reversals" : {
      "href" : "https://api-test.payline.io:443/settlements/STt3KJN4k1f9jCgJuJvZxVF7/transfers?type=reverse"
    },
    "credits" : {
      "href" : "https://api-test.payline.io:443/settlements/STt3KJN4k1f9jCgJuJvZxVF7/transfers?type=credit"
    },
    "debits" : {
      "href" : "https://api-test.payline.io:443/settlements/STt3KJN4k1f9jCgJuJvZxVF7/transfers?type=debit"
    }
  }
}

Awesome! Now you know how to charge a card. Next you need to settle out the funds to your merchant’s bank account (i.e. issue an ACH Credit). To do so you will create a Settlement resource. A Settlement is a logical construct representing a collection (i.e. batch) of Transfers that are intended to be paid out to a specific Merchant.

Each settlement is comprised of all the Transfers that have a SUCCEEDED state and that have not yet been previously settled out. In other words, if a merchant has a Transfer in the PENDING state it will not be included in the batch settlement. In addition, Settlements will include any refunded Transfers as a deduction. The total_amount minus the total_fee equals the net_amount (the amount in cents that will be deposited into your merchant’s bank account).

Note that for reconciliation purposes each Settlement contains a transfers link which returns a list of all the Transfers that comprise the batch.

HTTP Request

POST https://api-test.payline.io/identities/:IDENTITY_ID/settlements

Request Arguments

Field Type Description
currency integer, required 3-letter currency code that the funds should be deposited (e.g. USD)
tags object, optional Key value pair for annotating custom meta data (e.g. order numbers)

Embedded Tokenization

Our embedded tokenization form ensures you remain out of PCI scope, while providing your end-users with a sleek, and seamless checkout experience.

With our form, sensitive card data never touches your servers and keeps you out of PCI scope by sending this info over SSL directly to Payline. For your convenience we’ve provided a jsfiddle as a live example.

Step 1: Create a Button

<!DOCTYPE html>
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <body>
        <button id="show-form">Add Your Card</button>
    </body>
</html>

Before collecting the sensitive payment information, we will need to add a button to the HTML where we’ll be hosting the iframe so that end-users can input their details.

We have provided a simple example to the right.

Step 2: Include library

To use the iframe you will need to include the library on the webpage where you’re hosting the aforementioned button. Please include the script as demonstrated to the right. Please refrain from hosting the iframe library locally as doing so prevents important updates.

<script type="text/javascript" src="https://vgs-assets.s3.amazonaws.com/payline-1.latest.js"></script>

Step 3: Configure the client

<script type="text/javascript">
    document.addEventListener("DOMContentLoaded", function(event) {
      document.getElementById('show-form').addEventListener('click', function() {
        Payline.openTokenizeCardForm({
          applicationName: 'Business Name',
          applicationId: 'APupypyYamsTMvnYaanN4EX7',
        }, function (tokenizedResponse) {
          // Define a callback to send your token to your back-end server
        });
      });
    });
 </script>

Next we need to configure the client so that it associates the card with your Application. We will also need to register a click event that fires when our users click on the button, thereby rendering the iframe on the page. Then when the form is submitted you’ll be returned a unique Token resource representing the submitted card details. We will also need to define a callback for handling that response.

In the next step we’ll show you how to claim the instrument via an authenticated HTTPS request on your back-end for future use.

Example Response:

{
  "id" : "TKa3oUgM6hZZ3xBEGv89YaHf",
  "fingerprint" : "FPR-1240667419",
  "created_at" : "2017-10-12T01:06:08.46Z",
  "updated_at" : "2017-10-12T01:06:08.46Z",
  "instrument_type" : "PAYMENT_CARD",
  "expires_at" : "2017-10-13T01:06:08.46Z",
  "currency" : "USD",
  "_links" : {
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    }
  }
}

Step 4: Associate the Token

curl https://api-test.payline.io/payment_instruments \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -d '
    {
        "token": "TKa3oUgM6hZZ3xBEGv89YaHf",
        "type": "TOKEN",
        "identity": "IDteVu9cMtNfZmeTr4pgaDeU"
    }'


import io.payline.payments.forms.*;
import io.payline.payments.views.*;
import io.payline.payments.interfaces.ApiError;
import io.payline.payments.interfaces.Maybe;

TokenAssociationForm tokenForm =  TokenAssociationForm.builder()
    .token("TKa3oUgM6hZZ3xBEGv89YaHf")
    .identity("IDteVu9cMtNfZmeTr4pgaDeU")
    .build();

Maybe<PaymentCard> cardResponse = api.instruments.post(tokenForm);
if (! cardResponse.succeeded()) {
    ApiError error = cardResponse.error();
    System.out.println(error.getCode());
    throw new RuntimeException("API error attempting to create Payment Card");
}
PaymentCard paymentCard = cardResponse.view();

<?php
use Payline\Resources\PaymentInstrument;

$card = new PaymentInstrument(
    array(
        "token"=> "TKa3oUgM6hZZ3xBEGv89YaHf",
        "type"=> "TOKEN",
        "identity"=> "IDteVu9cMtNfZmeTr4pgaDeU"
    ));
$card = $card->save();



from payline.resources import PaymentInstrument

payment_instrument = PaymentInstrument(**
    {
        "token": "TKa3oUgM6hZZ3xBEGv89YaHf",
        "type": "TOKEN",
        "identity": "IDteVu9cMtNfZmeTr4pgaDeU"
    }).save()

card = Payline::PaymentInstrument.new(
    {
        "token"=> "TKa3oUgM6hZZ3xBEGv89YaHf",
        "type"=> "TOKEN",
        "identity"=> "IDteVu9cMtNfZmeTr4pgaDeU"
    }).save

Example Response:

{
  "id" : "PIa3oUgM6hZZ3xBEGv89YaHf",
  "fingerprint" : "FPR-1240667419",
  "tags" : { },
  "expiration_month" : 12,
  "expiration_year" : 2020,
  "last_four" : "0454",
  "brand" : "VISA",
  "card_type" : "UNKNOWN",
  "name" : null,
  "address" : {
    "line1" : "741 Douglass St",
    "line2" : "Apartment 7",
    "city" : "San Mateo",
    "region" : "CA",
    "postal_code" : "94114",
    "country" : "USA"
  },
  "address_verification" : "UNKNOWN",
  "security_code_verification" : "UNKNOWN",
  "created_at" : "2017-10-12T01:06:09.38Z",
  "updated_at" : "2017-10-12T01:06:09.38Z",
  "instrument_type" : "PAYMENT_CARD",
  "type" : "PAYMENT_CARD",
  "currency" : "USD",
  "identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PIa3oUgM6hZZ3xBEGv89YaHf"
    },
    "authorizations" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PIa3oUgM6hZZ3xBEGv89YaHf/authorizations"
    },
    "identity" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
    },
    "transfers" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PIa3oUgM6hZZ3xBEGv89YaHf/transfers"
    },
    "verifications" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PIa3oUgM6hZZ3xBEGv89YaHf/verifications"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    },
    "updates" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PIa3oUgM6hZZ3xBEGv89YaHf/updates"
    }
  }
}

Associate the newly tokenized card or bank with the instrument owner’s Identity.

HTTP Request

POST https://api-test.payline.io/payment_instruments

Request Arguments

Field Type Description
token string, required ID for the Token that was returned via the tokenization client or hosted iframe
type string, required Must pass TOKEN as the value
identity string, required ID for the Identity resource which the account is to be associated

Tokenization with Hosted Fields

Library summary

The SecureForm library is a javascript library that allows you to integrate secure fields with non-secure fields in your page. The secure fields behave like traditional input fields while preventing access to the unsecured data.

Once the fields are initialized the library communicates the state of the fields through a JavaScript callback. The state object includes information about the validity, focused value and if the user has entered information in the field.

For a complete example of how to use the library please refer to this jsFiddle example.

Step 1: Include library

 <script type="text/javascript" src="https://js.verygoodvault.com/js-vgfield-2/payline.js"></script>

First we’ll need to include the library on the webpage where you’re hosting your form. Please include the script as demonstrated to the right.

Step 2: Initialize the secure form

SecureForm.create(environment, onUpdateCallback)-> Form


/*
SecureForm.create(environment, onUpdateCallback)-> Form
*/

const secureForm = SecureForm.create('sandbox', function(state) {
   // Logic for interacting with form's potential states
 });

The next step is to configure the library. This method is the single entry point into the library. It initializes and returns a Form object representing the secured form.

Arguments

Field Type Description
environment string, required sandbox for testing and live for production
onUpdateCallback function, required Callback that will be called whenever the form state changes. It receives the state object representing the current state.

Step 3: Configure the form fields

Form#field(selector, properties)-> Field


/*
Form#field(selector, properties)-> Field
*/

secureForm.field('#my-cool-parent', {
    'successColor': '#3c763d',
    'errorColor': '#a94442',
    'lineHeight': '1.5rem',
    'fontSize': '24px',
    'fontFamily': 'Comic Sans',
    'color': '#31708f',
    'placeholder': 'Card number',
    'name': 'cc-number',
    'type': 'card-number',
    'validations': [],
});

Now that we have a Form object we’ll want to style it and add any validations.

Arguments

Field Type Description
selector string, required CSS Selector that points to the element where the field will be added

Properties Object

Field Type Description
name string, required Name of the input field. Will be used when submitting the data.
type string, required Type of the input field (card-number, card-security-code, card-expiration-date, text, password, number, zip-code)
validations array, optional Array of validations that will be used to calculate the isValid state (required, validCardExpirationDate, validCardNumber, validCardSecurityCode)
placeholder string, optional Text displayed when the field is empty
successColor string, optional Text color when the field is valid
errorColor string, optional Text color when the field is invalid
color string, optional Text color
lineHeight string, optional Line height value
fontSize string, optional Size of text
fontFamily string, optional Font family used in the text.

Example Response:

{
  "number": {
    "isDirty": false,
    "isFocused": false,
    "errorMessages": [
      "is required",
      "is not a valid card number"
    ],
    "isValid": false,
    "name": "number"
  },
  "security_code": {
    "isDirty": false,
    "isFocused": false,
    "errorMessages": [
      "is required",
      "is not a valid security code"
    ],
    "isValid": false,
    "name": "security_code"
  },
  "expiration_month": {
    "isDirty": false,
    "isFocused": false,
    "errorMessages": [
      "is required"
    ],
    "isValid": false,
    "name": "expiration_month"
  },
  "expiration_year": {
    "isDirty": false,
    "isFocused": false,
    "errorMessages": [
      "is required"
    ],
    "isValid": false,
    "name": "expiration_year"
  }
}

Step 4: Submit payload and handle response

Form#submit(path, options, callback) -> Form


/*
Form#submit(path, options, callback)-> Form
*/

document.getElementById('cc-form')
  .addEventListener('submit', function(e) {
    e.preventDefault();
    secureForm.submit('/applications/APupypyYamsTMvnYaanN4EX7/tokens', {
        data: {
            type: 'PAYMENT_CARD',
        },
    }, function(status, response) {
        // callback for handling response and sending token to back-end server
        console.log("Response has been received", status, response);
    });
}, false);

Example Response:

{
  "id" : "TKa3oUgM6hZZ3xBEGv89YaHf",
  "fingerprint" : "FPR-1240667419",
  "created_at" : "2017-10-12T01:06:08.46Z",
  "updated_at" : "2017-10-12T01:06:08.46Z",
  "instrument_type" : "PAYMENT_CARD",
  "expires_at" : "2017-10-13T01:06:08.46Z",
  "currency" : "USD",
  "_links" : {
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    }
  }
}

Finally we will need to register a click event that fires when our users submit the form and define a callback for handling the response.

Next, configure the library to your specific Application where all of the form fields will be submitted during the executed POST request. We’ll also want to register a click event that fires when our users submit the form and define a callback for handling the response.

Once you’ve handled the response you will want to store that ID to utilize the token in the future. To do this you will need to send the ID from your front-end client to your back-end server.

Arguments

Field Type Description
path string, required Path to your Application's tokens endpoint
options object, required Options object that can include additional data, such as the type of Payment Instrument
callback function, required Callback that will be executed when the HTTPRequest is finished. The callback receives the HTTP status code and the data as two arguments.

Step 5: Associate to an Identity

curl https://api-test.payline.io/payment_instruments \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -d '
    {
        "token": "TKa3oUgM6hZZ3xBEGv89YaHf",
        "type": "TOKEN",
        "identity": "IDteVu9cMtNfZmeTr4pgaDeU"
    }'

import io.payline.payments.forms.*;
import io.payline.payments.views.*;
import io.payline.payments.interfaces.ApiError;
import io.payline.payments.interfaces.Maybe;

TokenAssociationForm tokenForm =  TokenAssociationForm.builder()
    .token("TKa3oUgM6hZZ3xBEGv89YaHf")
    .identity("IDteVu9cMtNfZmeTr4pgaDeU")
    .build();

Maybe<PaymentCard> cardResponse = api.instruments.post(tokenForm);
if (! cardResponse.succeeded()) {
    ApiError error = cardResponse.error();
    System.out.println(error.getCode());
    throw new RuntimeException("API error attempting to create Payment Card");
}
PaymentCard paymentCard = cardResponse.view();

<?php
use Payline\Resources\PaymentInstrument;

$card = new PaymentInstrument(
    array(
        "token"=> "TKa3oUgM6hZZ3xBEGv89YaHf",
        "type"=> "TOKEN",
        "identity"=> "IDteVu9cMtNfZmeTr4pgaDeU"
    ));
$card = $card->save();



from payline.resources import PaymentInstrument

payment_instrument = PaymentInstrument(**
    {
        "token": "TKa3oUgM6hZZ3xBEGv89YaHf",
        "type": "TOKEN",
        "identity": "IDteVu9cMtNfZmeTr4pgaDeU"
    }).save()

card = Payline::PaymentInstrument.new(
    {
        "token"=> "TKa3oUgM6hZZ3xBEGv89YaHf",
        "type"=> "TOKEN",
        "identity"=> "IDteVu9cMtNfZmeTr4pgaDeU"
    }).save

Example Response:

{
  "id" : "PIa3oUgM6hZZ3xBEGv89YaHf",
  "fingerprint" : "FPR-1240667419",
  "tags" : { },
  "expiration_month" : 12,
  "expiration_year" : 2020,
  "last_four" : "0454",
  "brand" : "VISA",
  "card_type" : "UNKNOWN",
  "name" : null,
  "address" : {
    "line1" : "741 Douglass St",
    "line2" : "Apartment 7",
    "city" : "San Mateo",
    "region" : "CA",
    "postal_code" : "94114",
    "country" : "USA"
  },
  "address_verification" : "UNKNOWN",
  "security_code_verification" : "UNKNOWN",
  "created_at" : "2017-10-12T01:06:09.38Z",
  "updated_at" : "2017-10-12T01:06:09.38Z",
  "instrument_type" : "PAYMENT_CARD",
  "type" : "PAYMENT_CARD",
  "currency" : "USD",
  "identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PIa3oUgM6hZZ3xBEGv89YaHf"
    },
    "authorizations" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PIa3oUgM6hZZ3xBEGv89YaHf/authorizations"
    },
    "identity" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
    },
    "transfers" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PIa3oUgM6hZZ3xBEGv89YaHf/transfers"
    },
    "verifications" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PIa3oUgM6hZZ3xBEGv89YaHf/verifications"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    },
    "updates" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PIa3oUgM6hZZ3xBEGv89YaHf/updates"
    }
  }
}

Before you can use the newly tokenized card or bank account you will need to associate it with an Identity. To do this you must make an authenticated POST request to the /payment_instruments endpoint with the relevant token and Identity information.

HTTP Request

POST https://api-test.payline.io/payment_instruments

Request Arguments

Field Type Description
token string, required ID for the Token that was returned via the tokenization client
type string, required Must pass TOKEN as the value
identity string, required ID for the Identity resource which the account is to be associated

Idempotency Requests

You’ll notice the authorization and transfer object have a field named idempotency_id which ensures the API request is only performed once. Why is this important? We’ve all experienced a hanging request while on a checkout page and feared that if we refresh or submit the payment again we’ll be charged twice. With Payline, we remove the ambiguity by having the user generate a unique idempotency_id and sending it with the normal payload. If the user attempts a request with the same idempotency_id, the response will raise an exception. Now you can rest assured that when you create an authorization or debit a bank account that the user will be protected from potential network issues by simply passing idempotency_id in body of the request.

Authorizations

An Authorization (also known as a card hold) reserves a specific amount on a card to be captured (i.e. debited) at a later date, usually within 7 days. When an Authorization is captured it produces a Transfer resource.

Create an Authorization

curl https://api-test.payline.io/authorizations \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -d '
    {
        "merchant_identity": "IDteVu9cMtNfZmeTr4pgaDeU",
        "currency": "USD",
        "amount": 100,
        "source": "PImmK4gYPPe7QYyqC5n9BCCo",
        "tags": {
            "order_number": "21DFASJSAKAS"
        }
    }'

import io.payline.payments.ApiClient;
import io.payline.payments.forms.*;
import io.payline.payments.views.*;
import io.payline.payments.interfaces.ApiError;
import io.payline.payments.interfaces.Maybe;

AuthorizationCreateForm formCreateAuthorization = AuthorizationCreateForm.builder()
                .amount(10000L)
                .merchantIdentity("IDteVu9cMtNfZmeTr4pgaDeU")
                .source("PImmK4gYPPe7QYyqC5n9BCCo")
                .build();

Maybe<Authorization> response = api.authorizations.post(formCreateAuthorization);

if (! response.succeeded()) {
  ApiError error = response.error();
  System.out.println(error.getMessage());
  throw new RuntimeException("API error attempting to creating Authorization");
}

Authorization authorization = response.view();

<?php
use Payline\Resources\Authorization;

$authorization = new Authorization(
    array(
        "merchant_identity"=> "IDteVu9cMtNfZmeTr4pgaDeU",
        "currency"=> "USD",
        "amount"=> 100,
        "source"=> "PImmK4gYPPe7QYyqC5n9BCCo",
        "tags"=> array(
            "order_number"=> "21DFASJSAKAS"
        )
    ));
$authorization = $authorization->save();




from payline.resources import Authorization

authorization = Authorization(**
    {
        "merchant_identity": "IDteVu9cMtNfZmeTr4pgaDeU",
        "currency": "USD",
        "amount": 100,
        "source": "PImmK4gYPPe7QYyqC5n9BCCo",
        "tags": {
            "order_number": "21DFASJSAKAS"
        }
    }).save()
authorization = Payline::Authorization.new(
    {
        "merchant_identity"=> "IDteVu9cMtNfZmeTr4pgaDeU",
        "currency"=> "USD",
        "amount"=> 100,
        "source"=> "PImmK4gYPPe7QYyqC5n9BCCo",
        "tags"=> {
            "order_number"=> "21DFASJSAKAS"
        }
    }).save

Example Response:

{
  "id" : "AUk2C1ctLqeZbkiRJGZhrwxw",
  "amount" : 100,
  "tags" : {
    "order_number" : "21DFASJSAKAS"
  },
  "state" : "SUCCEEDED",
  "currency" : "USD",
  "transfer" : null,
  "messages" : [ ],
  "raw" : null,
  "created_at" : "2017-10-12T01:06:04.23Z",
  "updated_at" : "2017-10-12T01:06:04.27Z",
  "trace_id" : "2ff94b68-09bb-42dc-9f9e-76f4f845a874",
  "source" : "PImmK4gYPPe7QYyqC5n9BCCo",
  "merchant_identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
  "is_void" : false,
  "expires_at" : "2017-10-19T01:06:04.23Z",
  "idempotency_id" : null,
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/authorizations/AUk2C1ctLqeZbkiRJGZhrwxw"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    },
    "merchant_identity" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
    }
  }
}

Authorizations have two possible states SUCCEEDED and FAILED. If the Authorization has succeeded, it must be captured before the expires_at or the funds will be released.

Learn how to prevent duplicate authorizations by passing an idempotency ID in the payload.

HTTP Request

POST https://api-test.payline.io/authorizations

Request Arguments

Field Type Description
source string, required The Payment Instrument that you will be performing the authorization
merchant_identity string, required The ID of the Identity for the merchant that you are transacting on behalf of
amount integer, required The amount of the authorization in cents
currency string, required 3-letter ISO code designating the currency (e.g. USD)
tags object, optional Key value pair for annotating custom meta data (e.g. order numbers)
idempotency_id string, optional A randomly generated value that you want associated with the request

Capture an Authorization

curl https://api-test.payline.io/authorizations/AUk2C1ctLqeZbkiRJGZhrwxw \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -X PUT \
    -d '
    {
        "fee": "10",
        "capture_amount": 100
    }'

import io.payline.payments.ApiClient;
import io.payline.payments.forms.*;
import io.payline.payments.views.*;
import io.payline.payments.interfaces.ApiError;
import io.payline.payments.interfaces.Maybe;

AuthorizationUpdateForm form = AuthorizationUpdateForm.builder()
        .captureAmount(100L)
        .fee(10L)
        .statementDescriptor("Order 123")
        .build();

Maybe<Authorization> responseAuthorization = api.authorizations.id("AUk2C1ctLqeZbkiRJGZhrwxw").put(form);

if (! responseAuthorization.succeeded()) {
    ApiError error = responseAuthorization.error();
    System.out.println(error.getMessage());
    throw new RuntimeException("API error attempting to capture authorization");
}
Authorization capturedAuth = responseAuthorization.view();

<?php
use Payline\Resources\Authorization;

$authorization = Authorization::retrieve('AUk2C1ctLqeZbkiRJGZhrwxw');
$authorization = $authorization->capture([
                    "capture_amount"=> 50,
                    "fee"=> 10
                ]);



from payline.resources import Authorization

authorization = Authorization.get(id="AUk2C1ctLqeZbkiRJGZhrwxw")
authorization.capture(**
    {
        "fee": "10",
        "capture_amount": 100
    })

authorization = Payline::Authorization.retrieve(:id=>"AUk2C1ctLqeZbkiRJGZhrwxw")
authorization = authorization.capture(
    {
        "fee"=> "10",
        "capture_amount"=> 100
    })



Example Response:

{
  "id" : "AUk2C1ctLqeZbkiRJGZhrwxw",
  "amount" : 100,
  "tags" : {
    "order_number" : "21DFASJSAKAS"
  },
  "state" : "SUCCEEDED",
  "currency" : "USD",
  "transfer" : "TR4Bgv1VHDePfYZdpUfUv9z6",
  "messages" : [ ],
  "raw" : null,
  "created_at" : "2017-10-12T01:06:04.16Z",
  "updated_at" : "2017-10-12T01:06:06.42Z",
  "trace_id" : "2ff94b68-09bb-42dc-9f9e-76f4f845a874",
  "source" : "PImmK4gYPPe7QYyqC5n9BCCo",
  "merchant_identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
  "is_void" : false,
  "expires_at" : "2017-10-19T01:06:04.16Z",
  "idempotency_id" : null,
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/authorizations/AUk2C1ctLqeZbkiRJGZhrwxw"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    },
    "transfer" : {
      "href" : "https://api-test.payline.io:443/transfers/TR4Bgv1VHDePfYZdpUfUv9z6"
    },
    "merchant_identity" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
    }
  }
}

Once successfully captured the transfer field of the Authorization will contain the ID for the corresponding Transfer resource. By default, Transfers will be in a PENDING state. PENDING means that the system hasn’t submitted the capture request as they are submitted via batch request. Once submited the state of the Transfer will update to SUCCEEDED.

HTTP Request

PUT https://api-test.payline.io/authorizations/:AUTHORIZATION_ID

URL Parameters

Parameter Description
:AUTHORIZATION_ID ID of the Authorization

Request Arguments

Field Type Description
capture_amount integer, required The amount of the Authorization you would like to capture in cents. Must be less than or equal to the amount of the Authorization
fee integer, optional Amount of the captured Authorization you would like to collect as your fee. Must be less than or equal to the amount

Void an Authorization


curl https://api-test.payline.io/authorizations/AUhiqyhrvtZqAsN87ndRuxXF \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -X PUT \
    -d '
    {
        "void_me": true
    }'

import io.payline.payments.ApiClient;
import io.payline.payments.forms.AuthorizationUpdateForm;
import io.payline.payments.interfaces.ApiError;
import io.payline.payments.interfaces.Maybe;
import io.payline.payments.views.*;

AuthorizationUpdateForm formVoid = AuthorizationUpdateForm.builder()
        .voidMe(true)
        .build();

Maybe<Authorization> response = api.authorizations.id("AUk2C1ctLqeZbkiRJGZhrwxw").put(formVoid);

if (! response.succeeded()) {
    System.out.println(response.error());
    throw new RuntimeException("API error attempting to void authorization");
}
Authorization voidAuthorization = response.view();

<?php
use Payline\Resources\Authorization;

$authorization = Authorization::retrieve('AUk2C1ctLqeZbkiRJGZhrwxw');
$authorization->void(true);
$authorization = $authorization->save();




from payline.resources import Authorization

authorization = Authorization.get(id="AUk2C1ctLqeZbkiRJGZhrwxw")
authorization.void()

authorization = Payline::Authorization.retrieve(:id=>"AUk2C1ctLqeZbkiRJGZhrwxw")
authorization = authorization.void

Example Response:

{
  "id" : "AUhiqyhrvtZqAsN87ndRuxXF",
  "amount" : 100,
  "tags" : {
    "order_number" : "21DFASJSAKAS"
  },
  "state" : "SUCCEEDED",
  "currency" : "USD",
  "transfer" : null,
  "messages" : [ ],
  "raw" : null,
  "created_at" : "2017-10-12T01:06:10.47Z",
  "updated_at" : "2017-10-12T01:06:11.44Z",
  "trace_id" : "73c28540-f8f5-4805-88df-ea970188ca98",
  "source" : "PImmK4gYPPe7QYyqC5n9BCCo",
  "merchant_identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
  "is_void" : true,
  "expires_at" : "2017-10-19T01:06:10.47Z",
  "idempotency_id" : null,
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/authorizations/AUhiqyhrvtZqAsN87ndRuxXF"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    },
    "merchant_identity" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
    }
  }
}

Cancels the Authorization thereby releasing the funds. After voiding an Authorization it can no longer be captured.

HTTP Request

PUT https://api-test.payline.io/authorizations/:AUTHORIZATION_ID

URL Parameters

Parameter Description
:AUTHORIZATION_ID ID of the Authorization

Request Arguments

Field Type Description
void_me boolean, required Set to True to void the Authorization

Fetch an Authorization


curl https://api-test.payline.io/authorizations/AUk2C1ctLqeZbkiRJGZhrwxw \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98

import io.payline.ApiClient;
import io.payline.payments.interfaces.Maybe;
import io.payline.payments.views.Authorization;

Maybe <Authorization> response =  api.authorizations
    .id("AUk2C1ctLqeZbkiRJGZhrwxw")
    .get();

if(! response.succeeded()){
    System.out.println(response.error());
    throw new RuntimeException("API error in attempting to fetch Authorization");
}

Authorization authorization = response.view();

<?php
use Payline\Resources\Authorization;

$authorization = Authorization::retrieve('AUk2C1ctLqeZbkiRJGZhrwxw');



from payline.resources import Authorization

authorization = Authorization.get(id="AUk2C1ctLqeZbkiRJGZhrwxw")
authorization = Payline::Authorization.retrieve(:id=>"AUk2C1ctLqeZbkiRJGZhrwxw")


Example Response:

{
  "id" : "AUk2C1ctLqeZbkiRJGZhrwxw",
  "amount" : 100,
  "tags" : {
    "order_number" : "21DFASJSAKAS"
  },
  "state" : "SUCCEEDED",
  "currency" : "USD",
  "transfer" : "TR4Bgv1VHDePfYZdpUfUv9z6",
  "messages" : [ ],
  "raw" : null,
  "created_at" : "2017-10-12T01:06:04.16Z",
  "updated_at" : "2017-10-12T01:06:06.42Z",
  "trace_id" : "2ff94b68-09bb-42dc-9f9e-76f4f845a874",
  "source" : "PImmK4gYPPe7QYyqC5n9BCCo",
  "merchant_identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
  "is_void" : false,
  "expires_at" : "2017-10-19T01:06:04.16Z",
  "idempotency_id" : null,
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/authorizations/AUk2C1ctLqeZbkiRJGZhrwxw"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    },
    "transfer" : {
      "href" : "https://api-test.payline.io:443/transfers/TR4Bgv1VHDePfYZdpUfUv9z6"
    },
    "merchant_identity" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
    }
  }
}

HTTP Request

GET https://api-test.payline.io/authorizations/:AUTHORIZATION_ID

URL Parameters

Parameter Description
:AUTHORIZATION_ID ID of the Authorization

List all Authorizations

curl https://api-test.payline.io/authorizations/ \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98

import io.finix.payments.ApiClient;
import io.finix.payments.interfaces.ApiError;
import io.finix.payments.interfaces.Maybe;
import io.finix.payments.lib.Page;
import io.finix.payments.views.*;

Maybe<Page<Authorization>> response = api.authorizations.get();

if (! response.succeeded()) {
   ApiError error = response.error();
   System.out.println(error.getCode());
   System.out.println(error.getMessage());
   System.out.println(error.getDetails());
   throw new RuntimeException("API error attempting to list all Authorizations");
}

 Page<Authorization> page = response.view();
 Page<Authorization> page2 = page.getNext();

<?php
use Payline\Resources\Authorization;

$authorizations = Authorization::getPagination("/authorizations");




from payline.resources import Authorization

authorization = Authorization.get()
authorizations = Payline::Authorization.retrieve

Example Response:

{
  "_embedded" : {
    "authorizations" : [ {
      "id" : "AUhiqyhrvtZqAsN87ndRuxXF",
      "amount" : 100,
      "tags" : {
        "order_number" : "21DFASJSAKAS"
      },
      "state" : "SUCCEEDED",
      "currency" : "USD",
      "transfer" : null,
      "messages" : [ ],
      "raw" : null,
      "created_at" : "2017-10-12T01:06:10.47Z",
      "updated_at" : "2017-10-12T01:06:11.44Z",
      "trace_id" : "73c28540-f8f5-4805-88df-ea970188ca98",
      "source" : "PImmK4gYPPe7QYyqC5n9BCCo",
      "merchant_identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
      "is_void" : true,
      "expires_at" : "2017-10-19T01:06:10.47Z",
      "idempotency_id" : null,
      "_links" : {
        "self" : {
          "href" : "https://api-test.payline.io:443/authorizations/AUhiqyhrvtZqAsN87ndRuxXF"
        },
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        },
        "merchant_identity" : {
          "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
        }
      }
    }, {
      "id" : "AUeN7Tkb3rcpsBR1dHr9EmjR",
      "amount" : 100,
      "tags" : {
        "order_number" : "21DFASJSAKAS"
      },
      "state" : "SUCCEEDED",
      "currency" : "USD",
      "transfer" : null,
      "messages" : [ ],
      "raw" : null,
      "created_at" : "2017-10-12T01:06:05.20Z",
      "updated_at" : "2017-10-12T01:06:05.27Z",
      "trace_id" : "7941353f-0283-4b26-b45b-73cb0ef7e9d7",
      "source" : "PImmK4gYPPe7QYyqC5n9BCCo",
      "merchant_identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
      "is_void" : false,
      "expires_at" : "2017-10-19T01:06:05.20Z",
      "idempotency_id" : "d6767b03e5994ab6819a59e117bef96e",
      "_links" : {
        "self" : {
          "href" : "https://api-test.payline.io:443/authorizations/AUeN7Tkb3rcpsBR1dHr9EmjR"
        },
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        },
        "merchant_identity" : {
          "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
        }
      }
    }, {
      "id" : "AUk2C1ctLqeZbkiRJGZhrwxw",
      "amount" : 100,
      "tags" : {
        "order_number" : "21DFASJSAKAS"
      },
      "state" : "SUCCEEDED",
      "currency" : "USD",
      "transfer" : "TR4Bgv1VHDePfYZdpUfUv9z6",
      "messages" : [ ],
      "raw" : null,
      "created_at" : "2017-10-12T01:06:04.16Z",
      "updated_at" : "2017-10-12T01:06:06.42Z",
      "trace_id" : "2ff94b68-09bb-42dc-9f9e-76f4f845a874",
      "source" : "PImmK4gYPPe7QYyqC5n9BCCo",
      "merchant_identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
      "is_void" : false,
      "expires_at" : "2017-10-19T01:06:04.16Z",
      "idempotency_id" : null,
      "_links" : {
        "self" : {
          "href" : "https://api-test.payline.io:443/authorizations/AUk2C1ctLqeZbkiRJGZhrwxw"
        },
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        },
        "transfer" : {
          "href" : "https://api-test.payline.io:443/transfers/TR4Bgv1VHDePfYZdpUfUv9z6"
        },
        "merchant_identity" : {
          "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io/authorizations?offset=0&limit=20&sort=created_at,desc"
    }
  },
  "page" : {
    "offset" : 0,
    "limit" : 20,
    "count" : 3
  }
}

HTTP Request

GET https://api-test.payline.io/authorizations/

Identities

An Identity resource represents either a buyer or a merchant and is in a many ways the centerpiece of the payment API’s architecture. Transfers and Payment Instruments must be associated with an Identity. For both buyers ans merchants this structure makes it easy to manage and reconcile their associated banks accounts, transaction history, and payouts.

Create an Identity for a Buyer



curl https://api-test.payline.io/identities \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -d '
    {
        "tags": {
            "key": "value"
        },
        "entity": {
            "phone": "7145677613",
            "first_name": "Ayisha",
            "last_name": "Chang",
            "email": "therock@gmail.com",
            "personal_address": {
                "city": "San Mateo",
                "country": "USA",
                "region": "CA",
                "line2": "Apartment 7",
                "line1": "741 Douglass St",
                "postal_code": "94114"
            }
        }
    }'

import io.payline.payments.forms.*;
import io.payline.payments.views.*;
import io.payline.payments.forms.Address;
import io.payline.payments.interfaces.ApiError;
import io.payline.payments.interfaces.Maybe;
import io.payline.payments.forms.Date;


IdentityForm form = IdentityForm.builder()
    .entity(
    IdentityEntityForm.builder()
        .firstName("dwayne")
        .lastName("Sunkhronos")
        .email("user@example.org")
        .personalAddress(
            Address.builder()
                .line1("741 Douglass St")
                .line2("Apartment 7")
                .city("San Mateo")
                .region("CA")
                .postalCode("94114")
                .country("USA")
                .build()
        )
        .build())
    .build();

Maybe<Identity> response = api.identities.post(form);

if (! response.succeeded()) {
    ApiError error = response.error();
    System.out.println(error.getCode());
    throw new RuntimeException("API error attempting to create Identity");
}

Identity identity = response.view();
<?php
use Payline\Resources\Identity;

$identity = new Identity(
    array(
        "tags"=> array(
            "key"=> "value"
        ),
        "entity"=> array(
            "phone"=> "7145677613",
            "first_name"=> "Ayisha",
            "last_name"=> "Chang",
            "email"=> "therock@gmail.com",
            "personal_address"=> array(
                "city"=> "San Mateo",
                "country"=> "USA",
                "region"=> "CA",
                "line2"=> "Apartment 7",
                "line1"=> "741 Douglass St",
                "postal_code"=> "94114"
            )
        )
    ));
$identity = $identity->save();



from payline.resources import Identity

identity = Identity(**
    {
        "tags": {
            "key": "value"
        },
        "entity": {
            "phone": "7145677613",
            "first_name": "Ayisha",
            "last_name": "Chang",
            "email": "therock@gmail.com",
            "personal_address": {
                "city": "San Mateo",
                "country": "USA",
                "region": "CA",
                "line2": "Apartment 7",
                "line1": "741 Douglass St",
                "postal_code": "94114"
            }
        }
    }).save()
identity = Payline::Identity.new(
    {
        "tags"=> {
            "key"=> "value"
        },
        "entity"=> {
            "phone"=> "7145677613",
            "first_name"=> "Ayisha",
            "last_name"=> "Chang",
            "email"=> "therock@gmail.com",
            "personal_address"=> {
                "city"=> "San Mateo",
                "country"=> "USA",
                "region"=> "CA",
                "line2"=> "Apartment 7",
                "line1"=> "741 Douglass St",
                "postal_code"=> "94114"
            }
        }
    }).save

Example Response:

{
  "id" : "IDjDBhJFWm36i6SykV9wV2bP",
  "entity" : {
    "title" : null,
    "first_name" : "Ayisha",
    "last_name" : "Chang",
    "email" : "therock@gmail.com",
    "business_name" : null,
    "business_type" : null,
    "doing_business_as" : null,
    "phone" : "7145677613",
    "business_phone" : null,
    "personal_address" : {
      "line1" : "741 Douglass St",
      "line2" : "Apartment 7",
      "city" : "San Mateo",
      "region" : "CA",
      "postal_code" : "94114",
      "country" : "USA"
    },
    "business_address" : null,
    "mcc" : null,
    "dob" : null,
    "max_transaction_amount" : 0,
    "amex_mid" : null,
    "discover_mid" : null,
    "url" : null,
    "annual_card_volume" : 0,
    "has_accepted_credit_cards_previously" : false,
    "incorporation_date" : null,
    "principal_percentage_ownership" : null,
    "short_business_name" : null,
    "ownership_type" : null,
    "tax_id_provided" : false,
    "business_tax_id_provided" : false,
    "default_statement_descriptor" : null
  },
  "tags" : {
    "key" : "value"
  },
  "created_at" : "2017-10-12T01:05:52.31Z",
  "updated_at" : "2017-10-12T01:05:52.31Z",
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP"
    },
    "verifications" : {
      "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP/verifications"
    },
    "merchants" : {
      "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP/merchants"
    },
    "settlements" : {
      "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP/settlements"
    },
    "authorizations" : {
      "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP/authorizations"
    },
    "transfers" : {
      "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP/transfers"
    },
    "payment_instruments" : {
      "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP/payment_instruments"
    },
    "disputes" : {
      "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP/disputes"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    }
  }
}

All fields for a buyer’s Identity are optional. However, a business_type field should not be passed. Passing a business_type indicates that the Identity should be treated as a merchant.

HTTP Request

POST https://api-test.payline.io/identities

Request Arguments

Field Type Description
first_name string, optional First name
last_name string, optional Last name
phone string, optional Phone number
email string, optional Email address
line1 string, optional First line of the address (max 60 characters)
line2 string, optional Second line of the address (max 60 characters)
city string, optional City (max 20 characters)
region string, optional 2-letter State code
postal_code string, optional Zip or Postal code (max 7 characters)
country string, optional 3-Letter Country code
tags object, optional Key value pair for annotating custom meta data (e.g. order numbers)

Create an Identity for a Merchant



curl https://api-test.payline.io/identities \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -d '
    {
        "tags": {
            "Studio Rating": "4.7"
        },
        "entity": {
            "last_name": "Sunkhronos",
            "max_transaction_amount": 12000000,
            "has_accepted_credit_cards_previously": true,
            "default_statement_descriptor": "Petes Coffee",
            "personal_address": {
                "city": "San Mateo",
                "country": "USA",
                "region": "CA",
                "line2": "Apartment 7",
                "line1": "741 Douglass St",
                "postal_code": "94114"
            },
            "incorporation_date": {
                "year": 1978,
                "day": 27,
                "month": 6
            },
            "business_address": {
                "city": "San Mateo",
                "country": "USA",
                "region": "CA",
                "line2": "Apartment 8",
                "line1": "741 Douglass St",
                "postal_code": "94114"
            },
            "ownership_type": "PRIVATE",
            "first_name": "dwayne",
            "title": "CEO",
            "business_tax_id": "123456789",
            "doing_business_as": "Petes Coffee",
            "principal_percentage_ownership": 50,
            "email": "user@example.org",
            "mcc": "0742",
            "phone": "1234567890",
            "business_name": "Petes Coffee",
            "tax_id": "123456789",
            "business_type": "INDIVIDUAL_SOLE_PROPRIETORSHIP",
            "business_phone": "+1 (408) 756-4497",
            "dob": {
                "year": 1978,
                "day": 27,
                "month": 6
            },
            "url": "www.PetesCoffee.com",
            "annual_card_volume": 12000000
        }
    }'

import io.payline.payments.ApiClient;
import io.payline.payments.enums.BusinessType;
import io.payline.payments.forms.Address;
import io.payline.payments.forms.Date;
import io.payline.payments.forms.IdentityEntityForm;
import io.payline.payments.forms.IdentityForm;
import io.payline.payments.interfaces.ApiError;
import io.payline.payments.interfaces.Maybe;
import io.payline.payments.views.Identity;


IdentityForm form = IdentityForm.builder()
  .entity(IdentityEntityForm.builder()
  .firstName("dwayne")
  .lastName("Sunkhronos")
  .email("user@example.org")
  .businessName("business inc")
  .businessType(BusinessType.LIMITED_LIABILITY_COMPANY)
  .doingBusinessAs("doingBusinessAs")
  .phone("1234567890")
  .businessPhone("+1 (408) 756-4497")
  .taxId("123456789")
  .businessTaxId("123456789")
  .personalAddress(Address.builder()
  .line1("741 Douglass St")
  .line2("Apartment 7")
  .city("San Mateo")
  .region("CA")
  .postalCode("94114")
  .country("USA")
  .build())
  .businessAddress(Address.builder()
  .line1("741 Douglass St")
  .line2("Apartment 7")
  .city("San Mateo")
  .region("CA")
  .postalCode("94114")
  .country("USA")
  .build())
  .dob(Date.builder().day(Integer.valueOf(27)).month(Integer.valueOf(5)).year(Integer.valueOf(1978)).build())
  .maxTransactionAmount(Long.valueOf(1000L))
  .mcc("7399").url("http://sample-entity.com")
  .annualCardVolume(Long.valueOf(100L))
  .defaultStatementDescriptor("Business Inc")
  .incorporationDate(Date.builder().day(Integer.valueOf(1)).month(Integer.valueOf(12)).year(Integer.valueOf(2012)).build())
  .principalPercentageOwnership(Integer.valueOf(51)).build()).build();

Maybe<Identity> response = api.identities.post(form);
if(! response.succeeded().booleanValue()) {
    ApiError error = response.error();
    System.out.println(error.getCode());
    throw new RuntimeException("API error attempting to create Identity");
}
    Identity identity = (Identity)response.view();


<?php
use Payline\Resources\Identity;

$identity = new Identity(
    array(
        "tags"=> array(
            "Studio Rating"=> "4.7"
        ),
        "entity"=> array(
            "last_name"=> "Sunkhronos",
            "max_transaction_amount"=> 12000000,
            "has_accepted_credit_cards_previously"=> true,
            "default_statement_descriptor"=> "Petes Coffee",
            "personal_address"=> array(
                "city"=> "San Mateo",
                "country"=> "USA",
                "region"=> "CA",
                "line2"=> "Apartment 7",
                "line1"=> "741 Douglass St",
                "postal_code"=> "94114"
            ),
            "incorporation_date"=> array(
                "year"=> 1978,
                "day"=> 27,
                "month"=> 6
            ),
            "business_address"=> array(
                "city"=> "San Mateo",
                "country"=> "USA",
                "region"=> "CA",
                "line2"=> "Apartment 8",
                "line1"=> "741 Douglass St",
                "postal_code"=> "94114"
            ),
            "ownership_type"=> "PRIVATE",
            "first_name"=> "dwayne",
            "title"=> "CEO",
            "business_tax_id"=> "123456789",
            "doing_business_as"=> "Petes Coffee",
            "principal_percentage_ownership"=> 50,
            "email"=> "user@example.org",
            "mcc"=> "0742",
            "phone"=> "1234567890",
            "business_name"=> "Petes Coffee",
            "tax_id"=> "123456789",
            "business_type"=> "INDIVIDUAL_SOLE_PROPRIETORSHIP",
            "business_phone"=> "+1 (408) 756-4497",
            "dob"=> array(
                "year"=> 1978,
                "day"=> 27,
                "month"=> 6
            ),
            "url"=> "www.PetesCoffee.com",
            "annual_card_volume"=> 12000000
        )
    )
);
$identity = $identity->save();



from payline.resources import Identity

identity = Identity(**
    {
        "tags": {
            "Studio Rating": "4.7"
        },
        "entity": {
            "last_name": "Sunkhronos",
            "max_transaction_amount": 12000000,
            "has_accepted_credit_cards_previously": True,
            "default_statement_descriptor": "Petes Coffee",
            "personal_address": {
                "city": "San Mateo",
                "country": "USA",
                "region": "CA",
                "line2": "Apartment 7",
                "line1": "741 Douglass St",
                "postal_code": "94114"
            },
            "incorporation_date": {
                "year": 1978,
                "day": 27,
                "month": 6
            },
            "business_address": {
                "city": "San Mateo",
                "country": "USA",
                "region": "CA",
                "line2": "Apartment 8",
                "line1": "741 Douglass St",
                "postal_code": "94114"
            },
            "ownership_type": "PRIVATE",
            "first_name": "dwayne",
            "title": "CEO",
            "business_tax_id": "123456789",
            "doing_business_as": "Petes Coffee",
            "principal_percentage_ownership": 50,
            "email": "user@example.org",
            "mcc": "0742",
            "phone": "1234567890",
            "business_name": "Petes Coffee",
            "tax_id": "123456789",
            "business_type": "INDIVIDUAL_SOLE_PROPRIETORSHIP",
            "business_phone": "+1 (408) 756-4497",
            "dob": {
                "year": 1978,
                "day": 27,
                "month": 6
            },
            "url": "www.PetesCoffee.com",
            "annual_card_volume": 12000000
        }
    }).save()
identity = Payline::Identity.new(
    {
        "tags"=> {
            "Studio Rating"=> "4.7"
        },
        "entity"=> {
            "last_name"=> "Sunkhronos",
            "max_transaction_amount"=> 12000000,
            "has_accepted_credit_cards_previously"=> true,
            "default_statement_descriptor"=> "Petes Coffee",
            "personal_address"=> {
                "city"=> "San Mateo",
                "country"=> "USA",
                "region"=> "CA",
                "line2"=> "Apartment 7",
                "line1"=> "741 Douglass St",
                "postal_code"=> "94114"
            },
            "incorporation_date"=> {
                "year"=> 1978,
                "day"=> 27,
                "month"=> 6
            },
            "business_address"=> {
                "city"=> "San Mateo",
                "country"=> "USA",
                "region"=> "CA",
                "line2"=> "Apartment 8",
                "line1"=> "741 Douglass St",
                "postal_code"=> "94114"
            },
            "ownership_type"=> "PRIVATE",
            "first_name"=> "dwayne",
            "title"=> "CEO",
            "business_tax_id"=> "123456789",
            "doing_business_as"=> "Petes Coffee",
            "principal_percentage_ownership"=> 50,
            "email"=> "user@example.org",
            "mcc"=> "0742",
            "phone"=> "1234567890",
            "business_name"=> "Petes Coffee",
            "tax_id"=> "123456789",
            "business_type"=> "INDIVIDUAL_SOLE_PROPRIETORSHIP",
            "business_phone"=> "+1 (408) 756-4497",
            "dob"=> {
                "year"=> 1978,
                "day"=> 27,
                "month"=> 6
            },
            "url"=> "www.PetesCoffee.com",
            "annual_card_volume"=> 12000000
        }
    }).save

Example Response:

{
  "id" : "IDteVu9cMtNfZmeTr4pgaDeU",
  "entity" : {
    "title" : "CEO",
    "first_name" : "dwayne",
    "last_name" : "Sunkhronos",
    "email" : "user@example.org",
    "business_name" : "Petes Coffee",
    "business_type" : "INDIVIDUAL_SOLE_PROPRIETORSHIP",
    "doing_business_as" : "Petes Coffee",
    "phone" : "1234567890",
    "business_phone" : "+1 (408) 756-4497",
    "personal_address" : {
      "line1" : "741 Douglass St",
      "line2" : "Apartment 7",
      "city" : "San Mateo",
      "region" : "CA",
      "postal_code" : "94114",
      "country" : "USA"
    },
    "business_address" : {
      "line1" : "741 Douglass St",
      "line2" : "Apartment 8",
      "city" : "San Mateo",
      "region" : "CA",
      "postal_code" : "94114",
      "country" : "USA"
    },
    "mcc" : "0742",
    "dob" : {
      "day" : 27,
      "month" : 6,
      "year" : 1978
    },
    "max_transaction_amount" : 12000000,
    "amex_mid" : null,
    "discover_mid" : null,
    "url" : "www.PetesCoffee.com",
    "annual_card_volume" : 12000000,
    "has_accepted_credit_cards_previously" : true,
    "incorporation_date" : {
      "day" : 27,
      "month" : 6,
      "year" : 1978
    },
    "principal_percentage_ownership" : 50,
    "short_business_name" : null,
    "ownership_type" : "PRIVATE",
    "tax_id_provided" : true,
    "business_tax_id_provided" : true,
    "default_statement_descriptor" : "Petes Coffee"
  },
  "tags" : {
    "Studio Rating" : "4.7"
  },
  "created_at" : "2017-10-12T01:05:39.66Z",
  "updated_at" : "2017-10-12T01:05:39.66Z",
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
    },
    "verifications" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/verifications"
    },
    "merchants" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/merchants"
    },
    "settlements" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/settlements"
    },
    "authorizations" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/authorizations"
    },
    "transfers" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/transfers"
    },
    "payment_instruments" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/payment_instruments"
    },
    "disputes" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/disputes"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    }
  }
}

Create an Identity resource with the merchant’s underwriting information.

HTTP Request

POST https://api-test.payline.io/identities

Business-specific Request Arguments

Field Type Description
business_name string, required Merchant’s full legal business name (If INDIVIDUAL_SOLE_PROPRIETORSHIP, please input first name, Full legal last name and middle initial; max 120 characters)
doing_business_as string, required Alternate name of the business. If no other name is used please use the same value for business_name (max 60 characters)
business_type string, required Please select one of the following values: INDIVIDUAL_SOLE_PROPRIETORSHIP, CORPORATION, LIMITED_LIABILITY_COMPANY, PARTNERSHIP, ASSOCIATION_ESTATE_TRUST, TAX_EXEMPT_ORGANIZATION, INTERNATIONAL_ORGANIZATION, GOVERNMENT_AGENCY
business_tax_id string, required Nine digit Tax Identification Number (TIN), Employer Identification Number (EIN) or if the business_type is INDIVIDUAL_SOLE_PROPRIETORSHIP and a Tax ID is not available, the principal’s Social Security Number (SSN)
url string, required Merchant’s publicly available website (max 100 characters)
business_phone string, required Customer service phone number where the merchant can be reached (max 10 characters)
incorporation_date object, required Date company was founded (See below for a full list of the child attributes)
business_address object, required Primary address for the legal entity (Full description of child attributes below)
ownership_type string, required Values can be either PUBLIC to indicate a publicly traded company or PRIVATE for privately held businesses

Principal-specific Request Arguments

(i.e. authorized representative or primary contact responsible for the account)

Field Type Description
first_name string, required Full legal first name of the merchant’s principal representative (max 20 characters)
last_name string, required Full legal last name of the merchant’s principal representative (max 20 characters)
title string, required Principal’s corporate title or role (i.e. Chief Executive Officer, CFO, etc.; max 60 characters)
principal_percentage_ownership integer, required Percentage of company owned by the principal (min 0; max 100)
tax_id string, required Nine digit Social Security Number (SSN) for the principal
dob object, required Principal’s date of birth (Full description of child attributes below)
phone string, required Principal’s phone number (max 10 characters)
email string, required Principal’s email address where they can be reached (max 100 characters)
personal_address object, required Principal’s personal home address. This field is used for identity verification purposes (Full description of child attributes below)

Processing-specific Request Arguments

Field Type Description
default_statement_descriptor string, required Billing descriptor displayed on the buyer’s bank or card statement (Length must be between 1 and 20 characters)
annual_card_volume integer, required Approximate annual credit card sales expected to be processed in cents by this merchant (max 23 characters)
max_transaction_amount integer, required Maximum amount that can be transacted for a single transaction in cents (max 12 characters)
mcc string, required Merchant Category Code (MCC) that this merchant will be classified under
has_accepted_credit_cards_previously boolean, optional Defaults to false if not passed

Address-object Request Arguments

Field Type Description
line1 string, required First line of the address (max 60 characters)
line2 string, optional Second line of the address (max 60 characters)
city string, required City (max 20 characters)
region string, required 2-letter State code
postal_code string, required Zip or Postal code (max 7 characters)
country string, required 3-Letter Country code

Incorporation Date-object Request Arguments

Field Type Description
day integer, required Day business was incorporated (between 1 and 31)
month integer, required Month business was incorporated (between 1 and 12)
year integer, required Year business was incorporated (4-digit)

DOB-object Request Arguments

Field Type Description
day integer, required Day of birth (between 1 and 31)
month integer, required Month of birth (between 1 and 12)
year integer, required Year of birth (4-digit)

Fetch a Identity


curl https://api-test.payline.io/identities/IDteVu9cMtNfZmeTr4pgaDeU \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98

import io.payline.payments.forms.*;
import io.payline.payments.views.*;
import io.payline.payments.interfaces.ApiError;
import io.payline.payments.interfaces.Maybe;
import com.google.common.collect.ImmutableMap;

Maybe<Identity> response = api.identities.id("IDteVu9cMtNfZmeTr4pgaDeU").get();
if (! response.succeeded()) {
    ApiError error = response.error();
    System.out.println(error.getCode());
    throw new RuntimeException("API error attempting to fetch Identity");
}
Identity identity = response.view();

<?php
use Payline\Resources\Identity;

$identity = Identity::retrieve('IDteVu9cMtNfZmeTr4pgaDeU');


from payline.resources import Identity
identity = Identity.get(id="IDteVu9cMtNfZmeTr4pgaDeU")

identity = Payline::Identity.retrieve(:id=>"IDteVu9cMtNfZmeTr4pgaDeU")


Example Response:

{
  "id" : "IDteVu9cMtNfZmeTr4pgaDeU",
  "entity" : {
    "title" : "CEO",
    "first_name" : "dwayne",
    "last_name" : "Sunkhronos",
    "email" : "user@example.org",
    "business_name" : "Petes Coffee",
    "business_type" : "INDIVIDUAL_SOLE_PROPRIETORSHIP",
    "doing_business_as" : "Petes Coffee",
    "phone" : "1234567890",
    "business_phone" : "+1 (408) 756-4497",
    "personal_address" : {
      "line1" : "741 Douglass St",
      "line2" : "Apartment 7",
      "city" : "San Mateo",
      "region" : "CA",
      "postal_code" : "94114",
      "country" : "USA"
    },
    "business_address" : {
      "line1" : "741 Douglass St",
      "line2" : "Apartment 8",
      "city" : "San Mateo",
      "region" : "CA",
      "postal_code" : "94114",
      "country" : "USA"
    },
    "mcc" : "0742",
    "dob" : {
      "day" : 27,
      "month" : 6,
      "year" : 1978
    },
    "max_transaction_amount" : 12000000,
    "amex_mid" : null,
    "discover_mid" : null,
    "url" : "www.PetesCoffee.com",
    "annual_card_volume" : 12000000,
    "has_accepted_credit_cards_previously" : true,
    "incorporation_date" : {
      "day" : 27,
      "month" : 6,
      "year" : 1978
    },
    "principal_percentage_ownership" : 50,
    "short_business_name" : null,
    "ownership_type" : "PRIVATE",
    "tax_id_provided" : true,
    "business_tax_id_provided" : true,
    "default_statement_descriptor" : "Petes Coffee"
  },
  "tags" : {
    "Studio Rating" : "4.7"
  },
  "created_at" : "2017-10-12T01:05:39.65Z",
  "updated_at" : "2017-10-12T01:05:39.65Z",
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
    },
    "verifications" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/verifications"
    },
    "merchants" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/merchants"
    },
    "settlements" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/settlements"
    },
    "authorizations" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/authorizations"
    },
    "transfers" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/transfers"
    },
    "payment_instruments" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/payment_instruments"
    },
    "disputes" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/disputes"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    }
  }
}

HTTP Request

GET https://api-test.payline.io/identities/:IDENTITY_ID

URL Parameters

Parameter Description
:IDENTITY_ID ID of the Identity

List all Identities

curl https://api-test.payline.io/identities/ \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98


import io.payline.payments.ApiClient;
import io.payline.payments.interfaces.ApiError;
import io.payline.payments.interfaces.Maybe;
import io.payline.payments.lib.Page;

Maybe<Page<Identity>> response = api.identities.get();

if (! response.succeeded()) {
    ApiError error = response.error();
    System.out.println(error.getCode());
    System.out.println(error.getMessage());
    System.out.println(error.getDetails());
    throw new RuntimeException("API error attempting to list all Identities");
}

Page<Identity> page = response.view();

<?php
use Payline\Resources\Identity;

$identities= Identity::getPagination("/identities");




from payline.resources import Identity
identity = Identity.get()

identities = Payline::Identity.retrieve


Example Response:

{
  "_embedded" : {
    "identities" : [ {
      "id" : "IDjDBhJFWm36i6SykV9wV2bP",
      "entity" : {
        "title" : null,
        "first_name" : "Ayisha",
        "last_name" : "Chang",
        "email" : "therock@gmail.com",
        "business_name" : null,
        "business_type" : null,
        "doing_business_as" : null,
        "phone" : "7145677613",
        "business_phone" : null,
        "personal_address" : {
          "line1" : "741 Douglass St",
          "line2" : "Apartment 7",
          "city" : "San Mateo",
          "region" : "CA",
          "postal_code" : "94114",
          "country" : "USA"
        },
        "business_address" : null,
        "mcc" : null,
        "dob" : null,
        "max_transaction_amount" : 0,
        "amex_mid" : null,
        "discover_mid" : null,
        "url" : null,
        "annual_card_volume" : 0,
        "has_accepted_credit_cards_previously" : false,
        "incorporation_date" : null,
        "principal_percentage_ownership" : null,
        "short_business_name" : null,
        "ownership_type" : null,
        "tax_id_provided" : false,
        "business_tax_id_provided" : false,
        "default_statement_descriptor" : null
      },
      "tags" : {
        "key" : "value"
      },
      "created_at" : "2017-10-12T01:05:52.30Z",
      "updated_at" : "2017-10-12T01:05:52.30Z",
      "_links" : {
        "self" : {
          "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP"
        },
        "verifications" : {
          "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP/verifications"
        },
        "merchants" : {
          "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP/merchants"
        },
        "settlements" : {
          "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP/settlements"
        },
        "authorizations" : {
          "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP/authorizations"
        },
        "transfers" : {
          "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP/transfers"
        },
        "payment_instruments" : {
          "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP/payment_instruments"
        },
        "disputes" : {
          "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP/disputes"
        },
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        }
      }
    }, {
      "id" : "ID3SjpVQw1QNKDAagBx4gdDs",
      "entity" : {
        "title" : "CEO",
        "first_name" : "dwayne",
        "last_name" : "Sunkhronos",
        "email" : "user@example.org",
        "business_name" : "Lees Sandwiches",
        "business_type" : "GOVERNMENT_AGENCY",
        "doing_business_as" : "Lees Sandwiches",
        "phone" : "1234567890",
        "business_phone" : "+1 (408) 756-4497",
        "personal_address" : {
          "line1" : "741 Douglass St",
          "line2" : "Apartment 7",
          "city" : "San Mateo",
          "region" : "CA",
          "postal_code" : "94114",
          "country" : "USA"
        },
        "business_address" : {
          "line1" : "741 Douglass St",
          "line2" : "Apartment 8",
          "city" : "San Mateo",
          "region" : "CA",
          "postal_code" : "94114",
          "country" : "USA"
        },
        "mcc" : "0742",
        "dob" : {
          "day" : 27,
          "month" : 6,
          "year" : 1978
        },
        "max_transaction_amount" : 12000000,
        "amex_mid" : null,
        "discover_mid" : null,
        "url" : "www.LeesSandwiches.com",
        "annual_card_volume" : 12000000,
        "has_accepted_credit_cards_previously" : true,
        "incorporation_date" : {
          "day" : 27,
          "month" : 6,
          "year" : 1978
        },
        "principal_percentage_ownership" : 50,
        "short_business_name" : null,
        "ownership_type" : "PUBLIC",
        "tax_id_provided" : true,
        "business_tax_id_provided" : true,
        "default_statement_descriptor" : "Lees Sandwiches"
      },
      "tags" : {
        "Studio Rating" : "4.7"
      },
      "created_at" : "2017-10-12T01:05:47.96Z",
      "updated_at" : "2017-10-12T01:05:47.96Z",
      "_links" : {
        "self" : {
          "href" : "https://api-test.payline.io:443/identities/ID3SjpVQw1QNKDAagBx4gdDs"
        },
        "verifications" : {
          "href" : "https://api-test.payline.io:443/identities/ID3SjpVQw1QNKDAagBx4gdDs/verifications"
        },
        "merchants" : {
          "href" : "https://api-test.payline.io:443/identities/ID3SjpVQw1QNKDAagBx4gdDs/merchants"
        },
        "settlements" : {
          "href" : "https://api-test.payline.io:443/identities/ID3SjpVQw1QNKDAagBx4gdDs/settlements"
        },
        "authorizations" : {
          "href" : "https://api-test.payline.io:443/identities/ID3SjpVQw1QNKDAagBx4gdDs/authorizations"
        },
        "transfers" : {
          "href" : "https://api-test.payline.io:443/identities/ID3SjpVQw1QNKDAagBx4gdDs/transfers"
        },
        "payment_instruments" : {
          "href" : "https://api-test.payline.io:443/identities/ID3SjpVQw1QNKDAagBx4gdDs/payment_instruments"
        },
        "disputes" : {
          "href" : "https://api-test.payline.io:443/identities/ID3SjpVQw1QNKDAagBx4gdDs/disputes"
        },
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        }
      }
    }, {
      "id" : "IDvkZp2k6ZCsdb4JzaZLrzW3",
      "entity" : {
        "title" : "CEO",
        "first_name" : "dwayne",
        "last_name" : "Sunkhronos",
        "email" : "user@example.org",
        "business_name" : "Lees Sandwiches",
        "business_type" : "TAX_EXEMPT_ORGANIZATION",
        "doing_business_as" : "Lees Sandwiches",
        "phone" : "1234567890",
        "business_phone" : "+1 (408) 756-4497",
        "personal_address" : {
          "line1" : "741 Douglass St",
          "line2" : "Apartment 7",
          "city" : "San Mateo",
          "region" : "CA",
          "postal_code" : "94114",
          "country" : "USA"
        },
        "business_address" : {
          "line1" : "741 Douglass St",
          "line2" : "Apartment 8",
          "city" : "San Mateo",
          "region" : "CA",
          "postal_code" : "94114",
          "country" : "USA"
        },
        "mcc" : "0742",
        "dob" : {
          "day" : 27,
          "month" : 6,
          "year" : 1978
        },
        "max_transaction_amount" : 12000000,
        "amex_mid" : null,
        "discover_mid" : null,
        "url" : "www.LeesSandwiches.com",
        "annual_card_volume" : 12000000,
        "has_accepted_credit_cards_previously" : true,
        "incorporation_date" : {
          "day" : 27,
          "month" : 6,
          "year" : 1978
        },
        "principal_percentage_ownership" : 50,
        "short_business_name" : null,
        "ownership_type" : "PUBLIC",
        "tax_id_provided" : true,
        "business_tax_id_provided" : true,
        "default_statement_descriptor" : "Lees Sandwiches"
      },
      "tags" : {
        "Studio Rating" : "4.7"
      },
      "created_at" : "2017-10-12T01:05:46.32Z",
      "updated_at" : "2017-10-12T01:05:46.32Z",
      "_links" : {
        "self" : {
          "href" : "https://api-test.payline.io:443/identities/IDvkZp2k6ZCsdb4JzaZLrzW3"
        },
        "verifications" : {
          "href" : "https://api-test.payline.io:443/identities/IDvkZp2k6ZCsdb4JzaZLrzW3/verifications"
        },
        "merchants" : {
          "href" : "https://api-test.payline.io:443/identities/IDvkZp2k6ZCsdb4JzaZLrzW3/merchants"
        },
        "settlements" : {
          "href" : "https://api-test.payline.io:443/identities/IDvkZp2k6ZCsdb4JzaZLrzW3/settlements"
        },
        "authorizations" : {
          "href" : "https://api-test.payline.io:443/identities/IDvkZp2k6ZCsdb4JzaZLrzW3/authorizations"
        },
        "transfers" : {
          "href" : "https://api-test.payline.io:443/identities/IDvkZp2k6ZCsdb4JzaZLrzW3/transfers"
        },
        "payment_instruments" : {
          "href" : "https://api-test.payline.io:443/identities/IDvkZp2k6ZCsdb4JzaZLrzW3/payment_instruments"
        },
        "disputes" : {
          "href" : "https://api-test.payline.io:443/identities/IDvkZp2k6ZCsdb4JzaZLrzW3/disputes"
        },
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        }
      }
    }, {
      "id" : "IDvKfn5AAgmndxtpHWZN5Pfy",
      "entity" : {
        "title" : "CEO",
        "first_name" : "dwayne",
        "last_name" : "Sunkhronos",
        "email" : "user@example.org",
        "business_name" : "Prestige World Wide",
        "business_type" : "INTERNATIONAL_ORGANIZATION",
        "doing_business_as" : "Prestige World Wide",
        "phone" : "1234567890",
        "business_phone" : "+1 (408) 756-4497",
        "personal_address" : {
          "line1" : "741 Douglass St",
          "line2" : "Apartment 7",
          "city" : "San Mateo",
          "region" : "CA",
          "postal_code" : "94114",
          "country" : "USA"
        },
        "business_address" : {
          "line1" : "741 Douglass St",
          "line2" : "Apartment 8",
          "city" : "San Mateo",
          "region" : "CA",
          "postal_code" : "94114",
          "country" : "USA"
        },
        "mcc" : "0742",
        "dob" : {
          "day" : 27,
          "month" : 6,
          "year" : 1978
        },
        "max_transaction_amount" : 12000000,
        "amex_mid" : null,
        "discover_mid" : null,
        "url" : "www.PrestigeWorldWide.com",
        "annual_card_volume" : 12000000,
        "has_accepted_credit_cards_previously" : true,
        "incorporation_date" : {
          "day" : 27,
          "month" : 6,
          "year" : 1978
        },
        "principal_percentage_ownership" : 50,
        "short_business_name" : null,
        "ownership_type" : "PRIVATE",
        "tax_id_provided" : true,
        "business_tax_id_provided" : true,
        "default_statement_descriptor" : "Prestige World Wide"
      },
      "tags" : {
        "Studio Rating" : "4.7"
      },
      "created_at" : "2017-10-12T01:05:45.01Z",
      "updated_at" : "2017-10-12T01:05:45.01Z",
      "_links" : {
        "self" : {
          "href" : "https://api-test.payline.io:443/identities/IDvKfn5AAgmndxtpHWZN5Pfy"
        },
        "verifications" : {
          "href" : "https://api-test.payline.io:443/identities/IDvKfn5AAgmndxtpHWZN5Pfy/verifications"
        },
        "merchants" : {
          "href" : "https://api-test.payline.io:443/identities/IDvKfn5AAgmndxtpHWZN5Pfy/merchants"
        },
        "settlements" : {
          "href" : "https://api-test.payline.io:443/identities/IDvKfn5AAgmndxtpHWZN5Pfy/settlements"
        },
        "authorizations" : {
          "href" : "https://api-test.payline.io:443/identities/IDvKfn5AAgmndxtpHWZN5Pfy/authorizations"
        },
        "transfers" : {
          "href" : "https://api-test.payline.io:443/identities/IDvKfn5AAgmndxtpHWZN5Pfy/transfers"
        },
        "payment_instruments" : {
          "href" : "https://api-test.payline.io:443/identities/IDvKfn5AAgmndxtpHWZN5Pfy/payment_instruments"
        },
        "disputes" : {
          "href" : "https://api-test.payline.io:443/identities/IDvKfn5AAgmndxtpHWZN5Pfy/disputes"
        },
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        }
      }
    }, {
      "id" : "ID8P1vjArRW6con5rAeKfWsK",
      "entity" : {
        "title" : "CEO",
        "first_name" : "dwayne",
        "last_name" : "Sunkhronos",
        "email" : "user@example.org",
        "business_name" : "Dunder Mifflin",
        "business_type" : "ASSOCIATION_ESTATE_TRUST",
        "doing_business_as" : "Dunder Mifflin",
        "phone" : "1234567890",
        "business_phone" : "+1 (408) 756-4497",
        "personal_address" : {
          "line1" : "741 Douglass St",
          "line2" : "Apartment 7",
          "city" : "San Mateo",
          "region" : "CA",
          "postal_code" : "94114",
          "country" : "USA"
        },
        "business_address" : {
          "line1" : "741 Douglass St",
          "line2" : "Apartment 8",
          "city" : "San Mateo",
          "region" : "CA",
          "postal_code" : "94114",
          "country" : "USA"
        },
        "mcc" : "0742",
        "dob" : {
          "day" : 27,
          "month" : 6,
          "year" : 1978
        },
        "max_transaction_amount" : 12000000,
        "amex_mid" : null,
        "discover_mid" : null,
        "url" : "www.DunderMifflin.com",
        "annual_card_volume" : 12000000,
        "has_accepted_credit_cards_previously" : true,
        "incorporation_date" : {
          "day" : 27,
          "month" : 6,
          "year" : 1978
        },
        "principal_percentage_ownership" : 50,
        "short_business_name" : null,
        "ownership_type" : "PRIVATE",
        "tax_id_provided" : true,
        "business_tax_id_provided" : true,
        "default_statement_descriptor" : "Dunder Mifflin"
      },
      "tags" : {
        "Studio Rating" : "4.7"
      },
      "created_at" : "2017-10-12T01:05:43.91Z",
      "updated_at" : "2017-10-12T01:05:43.91Z",
      "_links" : {
        "self" : {
          "href" : "https://api-test.payline.io:443/identities/ID8P1vjArRW6con5rAeKfWsK"
        },
        "verifications" : {
          "href" : "https://api-test.payline.io:443/identities/ID8P1vjArRW6con5rAeKfWsK/verifications"
        },
        "merchants" : {
          "href" : "https://api-test.payline.io:443/identities/ID8P1vjArRW6con5rAeKfWsK/merchants"
        },
        "settlements" : {
          "href" : "https://api-test.payline.io:443/identities/ID8P1vjArRW6con5rAeKfWsK/settlements"
        },
        "authorizations" : {
          "href" : "https://api-test.payline.io:443/identities/ID8P1vjArRW6con5rAeKfWsK/authorizations"
        },
        "transfers" : {
          "href" : "https://api-test.payline.io:443/identities/ID8P1vjArRW6con5rAeKfWsK/transfers"
        },
        "payment_instruments" : {
          "href" : "https://api-test.payline.io:443/identities/ID8P1vjArRW6con5rAeKfWsK/payment_instruments"
        },
        "disputes" : {
          "href" : "https://api-test.payline.io:443/identities/ID8P1vjArRW6con5rAeKfWsK/disputes"
        },
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        }
      }
    }, {
      "id" : "IDnQtm9ktrGPgJLJ8nUbNJvy",
      "entity" : {
        "title" : "CEO",
        "first_name" : "dwayne",
        "last_name" : "Sunkhronos",
        "email" : "user@example.org",
        "business_name" : "ACME Anchors",
        "business_type" : "PARTNERSHIP",
        "doing_business_as" : "ACME Anchors",
        "phone" : "1234567890",
        "business_phone" : "+1 (408) 756-4497",
        "personal_address" : {
          "line1" : "741 Douglass St",
          "line2" : "Apartment 7",
          "city" : "San Mateo",
          "region" : "CA",
          "postal_code" : "94114",
          "country" : "USA"
        },
        "business_address" : {
          "line1" : "741 Douglass St",
          "line2" : "Apartment 8",
          "city" : "San Mateo",
          "region" : "CA",
          "postal_code" : "94114",
          "country" : "USA"
        },
        "mcc" : "0742",
        "dob" : {
          "day" : 27,
          "month" : 6,
          "year" : 1978
        },
        "max_transaction_amount" : 12000000,
        "amex_mid" : null,
        "discover_mid" : null,
        "url" : "www.ACMEAnchors.com",
        "annual_card_volume" : 12000000,
        "has_accepted_credit_cards_previously" : true,
        "incorporation_date" : {
          "day" : 27,
          "month" : 6,
          "year" : 1978
        },
        "principal_percentage_ownership" : 50,
        "short_business_name" : null,
        "ownership_type" : "PRIVATE",
        "tax_id_provided" : true,
        "business_tax_id_provided" : true,
        "default_statement_descriptor" : "ACME Anchors"
      },
      "tags" : {
        "Studio Rating" : "4.7"
      },
      "created_at" : "2017-10-12T01:05:42.74Z",
      "updated_at" : "2017-10-12T01:05:42.74Z",
      "_links" : {
        "self" : {
          "href" : "https://api-test.payline.io:443/identities/IDnQtm9ktrGPgJLJ8nUbNJvy"
        },
        "verifications" : {
          "href" : "https://api-test.payline.io:443/identities/IDnQtm9ktrGPgJLJ8nUbNJvy/verifications"
        },
        "merchants" : {
          "href" : "https://api-test.payline.io:443/identities/IDnQtm9ktrGPgJLJ8nUbNJvy/merchants"
        },
        "settlements" : {
          "href" : "https://api-test.payline.io:443/identities/IDnQtm9ktrGPgJLJ8nUbNJvy/settlements"
        },
        "authorizations" : {
          "href" : "https://api-test.payline.io:443/identities/IDnQtm9ktrGPgJLJ8nUbNJvy/authorizations"
        },
        "transfers" : {
          "href" : "https://api-test.payline.io:443/identities/IDnQtm9ktrGPgJLJ8nUbNJvy/transfers"
        },
        "payment_instruments" : {
          "href" : "https://api-test.payline.io:443/identities/IDnQtm9ktrGPgJLJ8nUbNJvy/payment_instruments"
        },
        "disputes" : {
          "href" : "https://api-test.payline.io:443/identities/IDnQtm9ktrGPgJLJ8nUbNJvy/disputes"
        },
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        }
      }
    }, {
      "id" : "IDcsuN9PScVcoYRUKVTE7DR",
      "entity" : {
        "title" : "CEO",
        "first_name" : "dwayne",
        "last_name" : "Sunkhronos",
        "email" : "user@example.org",
        "business_name" : "Pawny City Hall",
        "business_type" : "LIMITED_LIABILITY_COMPANY",
        "doing_business_as" : "Pawny City Hall",
        "phone" : "1234567890",
        "business_phone" : "+1 (408) 756-4497",
        "personal_address" : {
          "line1" : "741 Douglass St",
          "line2" : "Apartment 7",
          "city" : "San Mateo",
          "region" : "CA",
          "postal_code" : "94114",
          "country" : "USA"
        },
        "business_address" : {
          "line1" : "741 Douglass St",
          "line2" : "Apartment 8",
          "city" : "San Mateo",
          "region" : "CA",
          "postal_code" : "94114",
          "country" : "USA"
        },
        "mcc" : "0742",
        "dob" : {
          "day" : 27,
          "month" : 6,
          "year" : 1978
        },
        "max_transaction_amount" : 12000000,
        "amex_mid" : null,
        "discover_mid" : null,
        "url" : "www.PawnyCityHall.com",
        "annual_card_volume" : 12000000,
        "has_accepted_credit_cards_previously" : true,
        "incorporation_date" : {
          "day" : 27,
          "month" : 6,
          "year" : 1978
        },
        "principal_percentage_ownership" : 50,
        "short_business_name" : null,
        "ownership_type" : "PRIVATE",
        "tax_id_provided" : true,
        "business_tax_id_provided" : true,
        "default_statement_descriptor" : "Pawny City Hall"
      },
      "tags" : {
        "Studio Rating" : "4.7"
      },
      "created_at" : "2017-10-12T01:05:41.67Z",
      "updated_at" : "2017-10-12T01:05:41.67Z",
      "_links" : {
        "self" : {
          "href" : "https://api-test.payline.io:443/identities/IDcsuN9PScVcoYRUKVTE7DR"
        },
        "verifications" : {
          "href" : "https://api-test.payline.io:443/identities/IDcsuN9PScVcoYRUKVTE7DR/verifications"
        },
        "merchants" : {
          "href" : "https://api-test.payline.io:443/identities/IDcsuN9PScVcoYRUKVTE7DR/merchants"
        },
        "settlements" : {
          "href" : "https://api-test.payline.io:443/identities/IDcsuN9PScVcoYRUKVTE7DR/settlements"
        },
        "authorizations" : {
          "href" : "https://api-test.payline.io:443/identities/IDcsuN9PScVcoYRUKVTE7DR/authorizations"
        },
        "transfers" : {
          "href" : "https://api-test.payline.io:443/identities/IDcsuN9PScVcoYRUKVTE7DR/transfers"
        },
        "payment_instruments" : {
          "href" : "https://api-test.payline.io:443/identities/IDcsuN9PScVcoYRUKVTE7DR/payment_instruments"
        },
        "disputes" : {
          "href" : "https://api-test.payline.io:443/identities/IDcsuN9PScVcoYRUKVTE7DR/disputes"
        },
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        }
      }
    }, {
      "id" : "IDtawDRf9F1PN5dVcMFDf6EN",
      "entity" : {
        "title" : "CEO",
        "first_name" : "dwayne",
        "last_name" : "Sunkhronos",
        "email" : "user@example.org",
        "business_name" : "ACME Anchors",
        "business_type" : "CORPORATION",
        "doing_business_as" : "ACME Anchors",
        "phone" : "1234567890",
        "business_phone" : "+1 (408) 756-4497",
        "personal_address" : {
          "line1" : "741 Douglass St",
          "line2" : "Apartment 7",
          "city" : "San Mateo",
          "region" : "CA",
          "postal_code" : "94114",
          "country" : "USA"
        },
        "business_address" : {
          "line1" : "741 Douglass St",
          "line2" : "Apartment 8",
          "city" : "San Mateo",
          "region" : "CA",
          "postal_code" : "94114",
          "country" : "USA"
        },
        "mcc" : "0742",
        "dob" : {
          "day" : 27,
          "month" : 6,
          "year" : 1978
        },
        "max_transaction_amount" : 12000000,
        "amex_mid" : null,
        "discover_mid" : null,
        "url" : "www.ACMEAnchors.com",
        "annual_card_volume" : 12000000,
        "has_accepted_credit_cards_previously" : true,
        "incorporation_date" : {
          "day" : 27,
          "month" : 6,
          "year" : 1978
        },
        "principal_percentage_ownership" : 50,
        "short_business_name" : null,
        "ownership_type" : "PRIVATE",
        "tax_id_provided" : true,
        "business_tax_id_provided" : true,
        "default_statement_descriptor" : "ACME Anchors"
      },
      "tags" : {
        "Studio Rating" : "4.7"
      },
      "created_at" : "2017-10-12T01:05:40.64Z",
      "updated_at" : "2017-10-12T01:05:40.64Z",
      "_links" : {
        "self" : {
          "href" : "https://api-test.payline.io:443/identities/IDtawDRf9F1PN5dVcMFDf6EN"
        },
        "verifications" : {
          "href" : "https://api-test.payline.io:443/identities/IDtawDRf9F1PN5dVcMFDf6EN/verifications"
        },
        "merchants" : {
          "href" : "https://api-test.payline.io:443/identities/IDtawDRf9F1PN5dVcMFDf6EN/merchants"
        },
        "settlements" : {
          "href" : "https://api-test.payline.io:443/identities/IDtawDRf9F1PN5dVcMFDf6EN/settlements"
        },
        "authorizations" : {
          "href" : "https://api-test.payline.io:443/identities/IDtawDRf9F1PN5dVcMFDf6EN/authorizations"
        },
        "transfers" : {
          "href" : "https://api-test.payline.io:443/identities/IDtawDRf9F1PN5dVcMFDf6EN/transfers"
        },
        "payment_instruments" : {
          "href" : "https://api-test.payline.io:443/identities/IDtawDRf9F1PN5dVcMFDf6EN/payment_instruments"
        },
        "disputes" : {
          "href" : "https://api-test.payline.io:443/identities/IDtawDRf9F1PN5dVcMFDf6EN/disputes"
        },
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        }
      }
    }, {
      "id" : "IDteVu9cMtNfZmeTr4pgaDeU",
      "entity" : {
        "title" : "CEO",
        "first_name" : "dwayne",
        "last_name" : "Sunkhronos",
        "email" : "user@example.org",
        "business_name" : "Petes Coffee",
        "business_type" : "INDIVIDUAL_SOLE_PROPRIETORSHIP",
        "doing_business_as" : "Petes Coffee",
        "phone" : "1234567890",
        "business_phone" : "+1 (408) 756-4497",
        "personal_address" : {
          "line1" : "741 Douglass St",
          "line2" : "Apartment 7",
          "city" : "San Mateo",
          "region" : "CA",
          "postal_code" : "94114",
          "country" : "USA"
        },
        "business_address" : {
          "line1" : "741 Douglass St",
          "line2" : "Apartment 8",
          "city" : "San Mateo",
          "region" : "CA",
          "postal_code" : "94114",
          "country" : "USA"
        },
        "mcc" : "0742",
        "dob" : {
          "day" : 27,
          "month" : 6,
          "year" : 1978
        },
        "max_transaction_amount" : 12000000,
        "amex_mid" : null,
        "discover_mid" : null,
        "url" : "www.PetesCoffee.com",
        "annual_card_volume" : 12000000,
        "has_accepted_credit_cards_previously" : true,
        "incorporation_date" : {
          "day" : 27,
          "month" : 6,
          "year" : 1978
        },
        "principal_percentage_ownership" : 50,
        "short_business_name" : null,
        "ownership_type" : "PRIVATE",
        "tax_id_provided" : true,
        "business_tax_id_provided" : true,
        "default_statement_descriptor" : "Petes Coffee"
      },
      "tags" : {
        "Studio Rating" : "4.7"
      },
      "created_at" : "2017-10-12T01:05:39.65Z",
      "updated_at" : "2017-10-12T01:05:39.65Z",
      "_links" : {
        "self" : {
          "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
        },
        "verifications" : {
          "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/verifications"
        },
        "merchants" : {
          "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/merchants"
        },
        "settlements" : {
          "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/settlements"
        },
        "authorizations" : {
          "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/authorizations"
        },
        "transfers" : {
          "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/transfers"
        },
        "payment_instruments" : {
          "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/payment_instruments"
        },
        "disputes" : {
          "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/disputes"
        },
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        }
      }
    }, {
      "id" : "IDxsNEgCXTAM8eYDuXL3zR7z",
      "entity" : {
        "title" : null,
        "first_name" : "dwayne",
        "last_name" : "Sunkhronos",
        "email" : "user@example.org",
        "business_name" : "Paypal",
        "business_type" : "LIMITED_LIABILITY_COMPANY",
        "doing_business_as" : "Paypal",
        "phone" : "1234567890",
        "business_phone" : "+1 (408) 756-4497",
        "personal_address" : {
          "line1" : "741 Douglass St",
          "line2" : "Apartment 7",
          "city" : "San Mateo",
          "region" : "CA",
          "postal_code" : "94114",
          "country" : "USA"
        },
        "business_address" : {
          "line1" : "741 Douglass St",
          "line2" : "Apartment 8",
          "city" : "San Mateo",
          "region" : "CA",
          "postal_code" : "94114",
          "country" : "USA"
        },
        "mcc" : null,
        "dob" : {
          "day" : 27,
          "month" : 5,
          "year" : 1978
        },
        "max_transaction_amount" : 1200000,
        "amex_mid" : null,
        "discover_mid" : null,
        "url" : null,
        "annual_card_volume" : 0,
        "has_accepted_credit_cards_previously" : false,
        "incorporation_date" : null,
        "principal_percentage_ownership" : null,
        "short_business_name" : null,
        "ownership_type" : null,
        "tax_id_provided" : true,
        "business_tax_id_provided" : true,
        "default_statement_descriptor" : null
      },
      "tags" : {
        "application_name" : "Paypal"
      },
      "created_at" : "2017-10-12T01:05:31.94Z",
      "updated_at" : "2017-10-12T01:05:31.95Z",
      "_links" : {
        "self" : {
          "href" : "https://api-test.payline.io:443/identities/IDxsNEgCXTAM8eYDuXL3zR7z"
        },
        "verifications" : {
          "href" : "https://api-test.payline.io:443/identities/IDxsNEgCXTAM8eYDuXL3zR7z/verifications"
        },
        "merchants" : {
          "href" : "https://api-test.payline.io:443/identities/IDxsNEgCXTAM8eYDuXL3zR7z/merchants"
        },
        "settlements" : {
          "href" : "https://api-test.payline.io:443/identities/IDxsNEgCXTAM8eYDuXL3zR7z/settlements"
        },
        "authorizations" : {
          "href" : "https://api-test.payline.io:443/identities/IDxsNEgCXTAM8eYDuXL3zR7z/authorizations"
        },
        "transfers" : {
          "href" : "https://api-test.payline.io:443/identities/IDxsNEgCXTAM8eYDuXL3zR7z/transfers"
        },
        "payment_instruments" : {
          "href" : "https://api-test.payline.io:443/identities/IDxsNEgCXTAM8eYDuXL3zR7z/payment_instruments"
        },
        "disputes" : {
          "href" : "https://api-test.payline.io:443/identities/IDxsNEgCXTAM8eYDuXL3zR7z/disputes"
        },
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io/identities?offset=0&limit=20&sort=created_at,desc"
    }
  },
  "page" : {
    "offset" : 0,
    "limit" : 20,
    "count" : 10
  }
}

HTTP Request

GET https://api-test.payline.io/identities/

Update an Identity

curl https://api-test.payline.io/identities/IDteVu9cMtNfZmeTr4pgaDeU \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -X PUT \
    -d '
    {
        "tags": {
            "key": "value_2"
        },
        "entity": {
            "business_phone": "+1 (408) 756-4497",
            "first_name": "Bernard",
            "last_name": "Lopez",
            "title": "CTO",
            "dob": {
                "year": 1988,
                "day": 2,
                "month": 5
            },
            "ownership_type": "PRIVATE",
            "has_accepted_credit_cards_previously": true,
            "mcc": "0742",
            "phone": "7144177878",
            "business_tax_id": "123456789",
            "max_transaction_amount": 1200000,
            "principal_percentage_ownership": 50,
            "doing_business_as": "Bobs Burgers",
            "annual_card_volume": 12000000,
            "default_statement_descriptor": "Bobs Burgers",
            "url": "www.BobsBurgers.com",
            "business_name": "Bobs Burgers",
            "personal_address": {
                "city": "San Diego",
                "country": "USA",
                "region": "CA",
                "line2": "Apartment 2",
                "line1": "712 Douglass St",
                "postal_code": "94194"
            },
            "email": "user@example.org",
            "tax_id": "999999999"
        }
    }'

import io.payline.payments.ApiClient;
import io.payline.payments.enums.BusinessType;
import io.payline.payments.forms.*;
import io.payline.payments.interfaces.Maybe;
import io.payline.payments.views.Identity;

IdentityForm form = IdentityForm.builder()
                .entity(
                  IdentityEntityForm.builder()
                      .firstName("dwayne")
                      .email("self@newdomain.com")
                      .businessPhone("+1 (408) 756-4497")
                      .build())
                .build();

Maybe<Identity> response = api.identities.id("IDteVu9cMtNfZmeTr4pgaDeU").put(form);

if (! response.succeeded()) {
    System.out.println(response.error());
    throw new RuntimeException("API error attempting to update identity");
}

Identity updatedIdentity = response.view();

<?php



from payline.resources import Identity

identity = Identity.get(id="IDteVu9cMtNfZmeTr4pgaDeU")
identity.entity["first_name"] = "Bernard"
identity.save()

identity = Payline::Identity.retrieve(:id=>"IDteVu9cMtNfZmeTr4pgaDeU")

identity.entity["first_name"] = "Bernard"
identity.save

Example Response:

{
  "id" : "IDteVu9cMtNfZmeTr4pgaDeU",
  "entity" : {
    "title" : "CTO",
    "first_name" : "Bernard",
    "last_name" : "Lopez",
    "email" : "user@example.org",
    "business_name" : "Bobs Burgers",
    "business_type" : "INDIVIDUAL_SOLE_PROPRIETORSHIP",
    "doing_business_as" : "Bobs Burgers",
    "phone" : "7144177878",
    "business_phone" : "+1 (408) 756-4497",
    "personal_address" : {
      "line1" : "712 Douglass St",
      "line2" : "Apartment 2",
      "city" : "San Diego",
      "region" : "CA",
      "postal_code" : "94194",
      "country" : "USA"
    },
    "business_address" : {
      "line1" : "741 Douglass St",
      "line2" : "Apartment 8",
      "city" : "San Mateo",
      "region" : "CA",
      "postal_code" : "94114",
      "country" : "USA"
    },
    "mcc" : "0742",
    "dob" : {
      "day" : 2,
      "month" : 5,
      "year" : 1988
    },
    "max_transaction_amount" : 1200000,
    "amex_mid" : null,
    "discover_mid" : null,
    "url" : "www.BobsBurgers.com",
    "annual_card_volume" : 12000000,
    "has_accepted_credit_cards_previously" : true,
    "incorporation_date" : {
      "day" : 27,
      "month" : 6,
      "year" : 1978
    },
    "principal_percentage_ownership" : 50,
    "short_business_name" : null,
    "ownership_type" : "PRIVATE",
    "tax_id_provided" : true,
    "business_tax_id_provided" : true,
    "default_statement_descriptor" : "Bobs Burgers"
  },
  "tags" : {
    "key" : "value_2"
  },
  "created_at" : "2017-10-12T01:05:39.65Z",
  "updated_at" : "2017-10-12T01:06:32.23Z",
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
    },
    "verifications" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/verifications"
    },
    "merchants" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/merchants"
    },
    "settlements" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/settlements"
    },
    "authorizations" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/authorizations"
    },
    "transfers" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/transfers"
    },
    "payment_instruments" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/payment_instruments"
    },
    "disputes" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU/disputes"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    }
  }
}

Update the information of a previously created Identity. Please note that in the case of merchant accounts this API request alone does not update this information on the underlying processor. To update the merchant’s information on the underlying processor you must update the merchant on the processor.

HTTP Request

POST https://api-test.payline.io/identities

Business-specific Request Arguments

Field Type Description
business_name string, required Merchant’s full legal business name (If INDIVIDUAL_SOLE_PROPRIETORSHIP, please input first name, Full legal last name and middle initial; max 120 characters)
doing_business_as string, required Alternate name of the business. If no other name is used please use the same value for business_name (max 60 characters)
business_type string, required Please select one of the following values: INDIVIDUAL_SOLE_PROPRIETORSHIP, CORPORATION, LIMITED_LIABILITY_COMPANY, PARTNERSHIP, ASSOCIATION_ESTATE_TRUST, TAX_EXEMPT_ORGANIZATION, INTERNATIONAL_ORGANIZATION, GOVERNMENT_AGENCY
business_tax_id string, required Nine digit Tax Identification Number (TIN), Employer Identification Number (EIN) or if the business_type is INDIVIDUAL_SOLE_PROPRIETORSHIP and a Tax ID is not available, the principal’s Social Security Number (SSN)
url string, required Merchant’s publicly available website (max 100 characters)
business_phone string, required Customer service phone number where the merchant can be reached (max 10 characters)
incorporation_date object, required Date company was founded (See below for a full list of the child attributes)
business_address object, required Primary address for the legal entity (Full description of child attributes below)
ownership_type string, required Values can be either PUBLIC to indicate a publicly traded company or PRIVATE for privately held businesses

Principal-specific Request Arguments

(i.e. authorized representative or primary contact responsible for the account)

Field Type Description
first_name string, required Full legal first name of the merchant’s principal representative (max 20 characters)
last_name string, required Full legal last name of the merchant’s principal representative (max 20 characters)
title string, required Principal’s corporate title or role (i.e. Chief Executive Officer, CFO, etc.; max 60 characters)
principal_percentage_ownership integer, required Percentage of company owned by the principal (min 0; max 100)
tax_id string, required Nine digit Social Security Number (SSN) for the principal
dob object, required Principal’s date of birth (Full description of child attributes below)
phone string, required Principal’s phone number (max 10 characters)
email string, required Principal’s email address where they can be reached (max 100 characters)
personal_address object, required Principal’s personal home address. This field is used for identity verification purposes (Full description of child attributes below)

Processing-specific Request Arguments

Field Type Description
default_statement_descriptor string, required Billing descriptor displayed on the buyer’s bank or card statement (Length must be between 1 and 20 characters)
annual_card_volume integer, required Approximate annual credit card sales expected to be processed in cents by this merchant (max 23 characters)
max_transaction_amount integer, required Maximum amount that can be transacted for a single transaction in cents (max 12 characters)
mcc string, required Merchant Category Code (MCC) that this merchant will be classified under
has_accepted_credit_cards_previously boolean, optional Defaults to false if not passed

Address-object Request Arguments

Field Type Description
line1 string, optional First line of the address (max 60 characters)
line2 string, optional Second line of the address (max 60 characters)
city string, required City (max 20 characters)
region string, optional 2-letter State code
postal_code string, optional Zip or Postal code (max 7 characters)
country string, optional 3-Letter Country code

Incorporation Date-object Request Arguments

Field Type Description
day integer, required Day business was incorporated (between 1 and 31)
month integer, required Month business was incorporated (between 1 and 12)
year integer, required Year business was incorporated (4-digit)

DOB-object Request Arguments

Field Type Description
day integer, required Day of birth (between 1 and 31)
month integer, required Month of birth (between 1 and 12)
year integer, required Year of birth (4-digit)

Provision a Merchant


curl https://api-test.payline.io/identities/IDteVu9cMtNfZmeTr4pgaDeU/merchants \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -d '
    {
        "processor": null,
        "tags": {
            "key_2": "value_2"
        }
    }'


import io.payline.payments.forms.*;
import io.payline.payments.views.*;
import io.payline.payments.interfaces.ApiError;
import io.payline.payments.interfaces.Maybe;
import com.google.common.collect.ImmutableMap;

Maybe<Identity> response = api.identities.id("IDteVu9cMtNfZmeTr4pgaDeU").get();
if (! response.succeeded()) {
    ApiError error = response.error();
    System.out.println(error.getCode());
    throw new RuntimeException("API error attempting to fetch Identity");
}
Identity identity = response.view();

MerchantUnderwritingForm form = MerchantUnderwritingForm.builder()
    .tags(ImmutableMap.of("key", "value"))
    .build();

Maybe<Merchant> merchantResponse = api.identities.id(identity.id).merchants.post(form);

if (! merchantResponse.succeeded()) {
            ApiError error = merchantResponse.error();
            System.out.println(error.getCode());
            throw new RuntimeException("API error attempting to provision Merchant");
        }
Merchant merchant = merchantResponse.view();

<?php
use Payline\Resources\Identity;
use Payline\Resources\Merchant;

$identity = Identity::retrieve('IDteVu9cMtNfZmeTr4pgaDeU');

$merchant = $identity->provisionMerchantOn(new Merchant());



from payline.resources import Identity
from payline.resources import Merchant

identity = Identity.get(id="IDteVu9cMtNfZmeTr4pgaDeU")
merchant = identity.provision_merchant_on(Merchant())

identity = Payline::Identity.retrieve(:id=>"IDteVu9cMtNfZmeTr4pgaDeU")

merchant = identity.provision_merchant

Example Response:

{
  "id" : "MUgv6PAeMd5FDgnFXYRT4RpM",
  "identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
  "verification" : "VI7CGMu5oZPVSdHdaVa3apfi",
  "merchant_profile" : "MP9ZDZqzGYQ5EULvbcVfmKYN",
  "processor" : "DUMMY_V1",
  "processing_enabled" : false,
  "settlement_enabled" : false,
  "tags" : { },
  "created_at" : "2017-10-12T01:05:50.98Z",
  "updated_at" : "2017-10-12T01:05:50.98Z",
  "onboarding_state" : "PROVISIONING",
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/merchants/MUgv6PAeMd5FDgnFXYRT4RpM"
    },
    "identity" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
    },
    "verifications" : {
      "href" : "https://api-test.payline.io:443/merchants/MUgv6PAeMd5FDgnFXYRT4RpM/verifications"
    },
    "merchant_profile" : {
      "href" : "https://api-test.payline.io:443/merchant_profiles/MP9ZDZqzGYQ5EULvbcVfmKYN"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    },
    "verification" : {
      "href" : "https://api-test.payline.io:443/verifications/VI7CGMu5oZPVSdHdaVa3apfi"
    }
  }
}

Provision a Merchant for a previously created Identity resource to begin transacting on their behalf.

Merchant resources can have 3 potential states:

  1. PROVISIONING: Request is pending (state will typically change after two minutes)

  2. APPROVED: Merchant has been approved and can begin processing

  3. REJECTED: Merchant was rejected by the processor either because the collected underwriting information was invalid or it failed one a number of regulatory and compliance checks (e.g. KYC, OFAC or MATCH)

HTTP Request

POST https://api-test.payline.io/identities/identity_id/merchants

URL Parameters

Parameter Description
identity_id ID of the Identity

Merchants

A Merchant resource represents a business’s merchant account on a processor. In other words, any web service that connects buyers (i.e. customers) and sellers (i.e. merchants).

Provision a Merchant

curl https://api-test.payline.io/identities/IDteVu9cMtNfZmeTr4pgaDeU/merchants \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -d '
    {
        "processor": null,
        "tags": {
            "key_2": "value_2"
        }
    }'

import io.payline.payments.interfaces.Maybe;
import io.payline.payments.views.*;
import io.finix.payments.forms.*;

MerchantUnderwritingForm form = MerchantUnderwritingForm.builder()
    .processor(null)
    .tags(ImmutableMap.of("key", "value"))
    .build();

Maybe<Merchant> underwriteMerchant = api.identities.id("IDteVu9cMtNfZmeTr4pgaDeU").merchants.post(form);

if(! underwriteMerchant.succeeded()){
   System.out.println(underwriteMerchant.error());
}

Merchant provisionMerchant = underwriteMerchant.view();

<?php
use Payline\Resources\Identity;
use Payline\Resources\Merchant;

$identity = Identity::retrieve('IDteVu9cMtNfZmeTr4pgaDeU');

$merchant = $identity->provisionMerchantOn(new Merchant());



from payline.resources import Identity
from payline.resources import Merchant

identity = Identity.get(id="IDteVu9cMtNfZmeTr4pgaDeU")
merchant = identity.provision_merchant_on(Merchant())

identity = Payline::Identity.retrieve(:id => "MUgv6PAeMd5FDgnFXYRT4RpM")

merchant = identity.provision_merchant

Example Response:

{
  "id" : "MUgv6PAeMd5FDgnFXYRT4RpM",
  "identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
  "verification" : "VI7CGMu5oZPVSdHdaVa3apfi",
  "merchant_profile" : "MP9ZDZqzGYQ5EULvbcVfmKYN",
  "processor" : "DUMMY_V1",
  "processing_enabled" : false,
  "settlement_enabled" : false,
  "tags" : { },
  "created_at" : "2017-10-12T01:05:50.98Z",
  "updated_at" : "2017-10-12T01:05:50.98Z",
  "onboarding_state" : "PROVISIONING",
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/merchants/MUgv6PAeMd5FDgnFXYRT4RpM"
    },
    "identity" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
    },
    "verifications" : {
      "href" : "https://api-test.payline.io:443/merchants/MUgv6PAeMd5FDgnFXYRT4RpM/verifications"
    },
    "merchant_profile" : {
      "href" : "https://api-test.payline.io:443/merchant_profiles/MP9ZDZqzGYQ5EULvbcVfmKYN"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    },
    "verification" : {
      "href" : "https://api-test.payline.io:443/verifications/VI7CGMu5oZPVSdHdaVa3apfi"
    }
  }
}

Provision a Merchant for a previously created Identity resource to begin transacting on their behalf.

Merchant resources can have 3 potential onboarding_states:

  1. PROVISIONING: Request is pending (state will typically change after two minutes)

    • processing_enabled: False
    • settlement_enabled: False
  2. APPROVED: Merchant has been approved and can begin processing

    • processing_enabled: True
    • settlement_enabled: True
  3. REJECTED: Merchant was rejected by the processor either because the collected information was invalid or it failed one of a number of regulatory and/or compliance checks (e.g. KYC, OFAC or MATCH)

    • processing_enabled: False
    • settlement_enabled: False

HTTP Request

POST https://api-test.payline.io/identities/:IDENTITY_ID/merchants

URL Parameters

Parameter Description
:IDENTITY_ID ID of the Identity

Fetch a Merchant

curl https://api-test.payline.io/merchants/MUgv6PAeMd5FDgnFXYRT4RpM \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98

import io.payline.payments.ApiClient;
import io.payline.payments.interfaces.Maybe;
import io.payline.payments.views.Merchant;

Maybe<Merchant> response = api.merchants
    .id(merchant.id)
    .get();

if(! response.succeeded()){
    System.out.println(response.error());
    System.out.println(response.error().getDetails());
    throw new RuntimeException("API error attempting to fetch Merchant");
}

Merchant merchantView = response.view();

<?php
use Payline\Resources\Merchant;

$merchant = Merchant::retrieve('MUgv6PAeMd5FDgnFXYRT4RpM');



from payline.resources import Merchant
merchant = Merchant.get(id="MUgv6PAeMd5FDgnFXYRT4RpM")

merchant = Payline::Merchant.retrieve(:id => "MUgv6PAeMd5FDgnFXYRT4RpM")

Example Response:

{
  "id" : "MUgv6PAeMd5FDgnFXYRT4RpM",
  "identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
  "verification" : null,
  "merchant_profile" : "MP9ZDZqzGYQ5EULvbcVfmKYN",
  "processor" : "DUMMY_V1",
  "processing_enabled" : true,
  "settlement_enabled" : true,
  "tags" : { },
  "created_at" : "2017-10-12T01:05:50.95Z",
  "updated_at" : "2017-10-12T01:05:51.06Z",
  "onboarding_state" : "APPROVED",
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/merchants/MUgv6PAeMd5FDgnFXYRT4RpM"
    },
    "identity" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
    },
    "verifications" : {
      "href" : "https://api-test.payline.io:443/merchants/MUgv6PAeMd5FDgnFXYRT4RpM/verifications"
    },
    "merchant_profile" : {
      "href" : "https://api-test.payline.io:443/merchant_profiles/MP9ZDZqzGYQ5EULvbcVfmKYN"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    }
  }
}

HTTP Request

GET https://api-test.payline.io/merchants/:MERCHANT_ID

URL Parameters

Parameter Description
:MERCHANT_ID ID of the Merchant

Reattempt Merchant Provisioning

curl https://api-test.payline.io/merchants/MUgv6PAeMd5FDgnFXYRT4RpM/verifications \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -d '{}'
Merchant merchant = client.merchantsClient().fetch("MUgv6PAeMd5FDgnFXYRT4RpM");
Verification verification = merchant.verify(
  Verification.builder().build()
);
<?php
use Payline\Resources\Merchant;
use Payline\Resources\Verification;

$merchant = Merchant::retrieve('MUgv6PAeMd5FDgnFXYRT4RpM');
$verification = new Verification();
$verification = $merchant->verifyOn($verification);


from payline.resources import Merchant
from payline.resources import Verification

merchant = Merchant.get(id="MUgv6PAeMd5FDgnFXYRT4RpM")

verification = merchant.verify_on(Verification())

merchant = Payline::Merchant.retrieve(:id => "MUgv6PAeMd5FDgnFXYRT4RpM")

verification = merchant.verify

Example Response:

{
  "id" : "VI4yGRWDbJKyB3cx62MWHP5g",
  "tags" : { },
  "messages" : [ ],
  "raw" : null,
  "processor" : "DUMMY_V1",
  "state" : "PENDING",
  "created_at" : "2017-10-12T01:06:34.77Z",
  "updated_at" : "2017-10-12T01:06:34.79Z",
  "trace_id" : "3e047dd2-d54a-4475-b867-f07b86d2fa25",
  "payment_instrument" : null,
  "merchant" : "MUgv6PAeMd5FDgnFXYRT4RpM",
  "identity" : null,
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/verifications/VI4yGRWDbJKyB3cx62MWHP5g"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    },
    "merchant" : {
      "href" : "https://api-test.payline.io:443/merchants/MUgv6PAeMd5FDgnFXYRT4RpM"
    }
  }
}

Re-attempt provisioning a Merchant account on a processor if the previous attempt returned a FAILED onboarding_state.

HTTP Request

POST https://api-test.payline.io/merchants/:MERCHANT_ID/verifications

URL Parameters

Parameter Description
:MERCHANT_ID ID of the Merchant

Update Info on Processor

curl https://api-test.payline.io/merchants/MUgv6PAeMd5FDgnFXYRT4RpM/verifications \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -d '{}'


<?php
use Payline\Resources\Merchant;
use Payline\Resources\Verification;

$merchant = Merchant::retrieve('MUgv6PAeMd5FDgnFXYRT4RpM');
$verification = new Verification();
$verification = $merchant->verifyOn($verification);


from payline.resources import Merchant
merchant = Merchant.get(id="MUgv6PAeMd5FDgnFXYRT4RpM")

merchant.entity["first_name"] = "Michael"
merchant.save()

merchant = Payline::Merchant.retrieve(:id => "MUgv6PAeMd5FDgnFXYRT4RpM")

verification = merchant.entity["default_statement_descriptor"] = "Prestige World Wide"

Example Response:

{
  "id" : "VI4yGRWDbJKyB3cx62MWHP5g",
  "tags" : { },
  "messages" : [ ],
  "raw" : null,
  "processor" : "DUMMY_V1",
  "state" : "PENDING",
  "created_at" : "2017-10-12T01:06:34.77Z",
  "updated_at" : "2017-10-12T01:06:34.79Z",
  "trace_id" : "3e047dd2-d54a-4475-b867-f07b86d2fa25",
  "payment_instrument" : null,
  "merchant" : "MUgv6PAeMd5FDgnFXYRT4RpM",
  "identity" : null,
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/verifications/VI4yGRWDbJKyB3cx62MWHP5g"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    },
    "merchant" : {
      "href" : "https://api-test.payline.io:443/merchants/MUgv6PAeMd5FDgnFXYRT4RpM"
    }
  }
}

Update Identity information (e.g. default_statement_descriptor, KYC info, etc.) on the underlying processor.

HTTP Request

POST https://api-test.payline.io/merchants/:MERCHANT_ID/verifications

URL Parameters

Parameter Description
:MERCHANT_ID ID of the Merchant

List all Merchants

curl https://api-test.payline.io/merchants/ \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98

import io.payline.payments.ApiClient;
import io.payline.payments.interfaces.ApiError;
import io.payline.payments.interfaces.Maybe;
import io.payline.payments.lib.Page;
import io.payline.payments.views.Merchant;

Maybe<Page<Merchant>> response = api.merchants.get();

if (! response.succeeded()) {
  ApiError error = response.error();
  System.out.println(error.getCode());
  System.out.println(error.getMessage());
  System.out.println(error.getDetails());
  throw new RuntimeException("API error attempting to list all Merchants");
}

Page<Merchant> page = response.view();

<?php
use Payline\Resources\Merchant;

$merchants = Merchant::getPagination("/merchants");




from payline.resources import Merchant
merchant = Merchant.get()

merchants = Payline::Merchant.retrieve

Example Response:

{
  "_embedded" : {
    "merchants" : [ {
      "id" : "MUgv6PAeMd5FDgnFXYRT4RpM",
      "identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
      "verification" : null,
      "merchant_profile" : "MP9ZDZqzGYQ5EULvbcVfmKYN",
      "processor" : "DUMMY_V1",
      "processing_enabled" : true,
      "settlement_enabled" : true,
      "tags" : { },
      "created_at" : "2017-10-12T01:05:50.95Z",
      "updated_at" : "2017-10-12T01:05:51.06Z",
      "onboarding_state" : "APPROVED",
      "_links" : {
        "self" : {
          "href" : "https://api-test.payline.io:443/merchants/MUgv6PAeMd5FDgnFXYRT4RpM"
        },
        "identity" : {
          "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
        },
        "verifications" : {
          "href" : "https://api-test.payline.io:443/merchants/MUgv6PAeMd5FDgnFXYRT4RpM/verifications"
        },
        "merchant_profile" : {
          "href" : "https://api-test.payline.io:443/merchant_profiles/MP9ZDZqzGYQ5EULvbcVfmKYN"
        },
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io/merchants?offset=0&limit=20&sort=created_at,desc"
    }
  },
  "page" : {
    "offset" : 0,
    "limit" : 20,
    "count" : 1
  }
}

HTTP Request

GET https://api-test.payline.io/merchants/

List Merchant Verifications

curl https://api-test.payline.io/merchants/MUgv6PAeMd5FDgnFXYRT4RpM/verifications \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98


<?php
use Payline\Resources\Merchant;
use Payline\Resources\Verification;

$merchant = Merchant::retrieve('MUgv6PAeMd5FDgnFXYRT4RpM');
$verifications = Verification::getPagination($merchant->getHref("verifications"));




from payline.resources import Merchant
merchant = Merchant.get(id="MUgv6PAeMd5FDgnFXYRT4RpM")
verifications = merchant.verifications

merchant = Payline::Merchant.retrieve(:id => "MUgv6PAeMd5FDgnFXYRT4RpM")
verifications = merchant.verifications

Example Response:

{
  "_embedded" : {
    "verifications" : [ {
      "id" : "VI7CGMu5oZPVSdHdaVa3apfi",
      "tags" : {
        "key_2" : "value_2"
      },
      "messages" : [ ],
      "raw" : "RawDummyMerchantUnderwriteResult",
      "processor" : "DUMMY_V1",
      "state" : "SUCCEEDED",
      "created_at" : "2017-10-12T01:05:50.95Z",
      "updated_at" : "2017-10-12T01:05:51.10Z",
      "trace_id" : "0f9f6dc1-a29c-4f9e-9009-38bef8f42a7f",
      "payment_instrument" : null,
      "merchant" : "MUgv6PAeMd5FDgnFXYRT4RpM",
      "identity" : null,
      "_links" : {
        "self" : {
          "href" : "https://api-test.payline.io:443/verifications/VI7CGMu5oZPVSdHdaVa3apfi"
        },
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        },
        "merchant" : {
          "href" : "https://api-test.payline.io:443/merchants/MUgv6PAeMd5FDgnFXYRT4RpM"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io/merchants/MUgv6PAeMd5FDgnFXYRT4RpM/verifications?offset=0&limit=20&sort=created_at,desc"
    }
  },
  "page" : {
    "offset" : 0,
    "limit" : 20,
    "count" : 1
  }
}

Retrieve all attempts to onboard (i.e. provision) a merchant onto a processor.

HTTP Request

GET https://api-test.payline.io/merchants/:MERCHANT_ID/verifications

URL Parameters

Parameter Description
:MERCHANT_ID ID of the Merchant

Payment Instruments

A Payment Instrument resource represents either a credit card or bank account. A Payment Instrument may be tokenized multiple times and each tokenization produces a unique ID. Each ID may only be associated one time and to only one Identity. Once associated, a Payment Instrument may not be disassociated from an Identity.

Create a Card



curl https://api-test.payline.io/payment_instruments \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -d '
    {
        "name": "Fran Le",
        "expiration_year": 2020,
        "tags": {
            "card_name": "Business Card"
        },
        "number": "4957030420210454",
        "expiration_month": 12,
        "address": {
            "city": "San Mateo",
            "country": "USA",
            "region": "CA",
            "line2": "Apartment 7",
            "line1": "741 Douglass St",
            "postal_code": "94114"
        },
        "security_code": "112",
        "type": "PAYMENT_CARD",
        "identity": "IDjDBhJFWm36i6SykV9wV2bP"
    }'


import io.payline.payments.forms.*;
import io.payline.payments.views.*;
import io.payline.payments.forms.Address;
import io.payline.payments.interfaces.ApiError;
import io.payline.payments.interfaces.Maybe;
import com.google.common.collect.ImmutableMap;

PaymentCardForm form = PaymentCardForm.builder()
        .name("Joe Doe")
        .number("4957030420210454")
        .securityCode("112")
        .expirationYear(2020)
        .identity("IDteVu9cMtNfZmeTr4pgaDeU")
        .expirationMonth(12)
        .address(
                Address.builder()
                        .city("San Mateo")
                        .country("USA")
                        .region("CA")
                        .line1("123 Fake St")
                        .line2("#7")
                        .postalCode("90210")
                        .build()
        )
        .tags(ImmutableMap.of("card_name", "Business Card"))
        .build();

Maybe<PaymentCard> response = api.instruments.post(form);
        if (! response.succeeded()) {
            ApiError error = response .error();
            System.out.println(error.getCode());
            throw new RuntimeException("API error attempting to create Payment Card");
        }
PaymentCard card = response.view();

<?php
use Payline\Resources\PaymentCard;
use Payline\Resources\Identity;

$identity = Identity::retrieve('IDteVu9cMtNfZmeTr4pgaDeU');
$card = new PaymentCard(
    array(
        "name"=> "Fran Le",
        "expiration_year"=> 2020,
        "tags"=> array(
            "card_name"=> "Business Card"
        ),
        "number"=> "4957030420210454",
        "expiration_month"=> 12,
        "address"=> array(
            "city"=> "San Mateo",
            "country"=> "USA",
            "region"=> "CA",
            "line2"=> "Apartment 7",
            "line1"=> "741 Douglass St",
            "postal_code"=> "94114"
        ),
        "security_code"=> "112",
        "type"=> "PAYMENT_CARD",
        "identity"=> "IDjDBhJFWm36i6SykV9wV2bP"
    ));
$card = $identity->createPaymentCard($card);



from payline.resources import PaymentCard

card = PaymentCard(**
    {
        "name": "Fran Le",
        "expiration_year": 2020,
        "tags": {
            "card_name": "Business Card"
        },
        "number": "4957030420210454",
        "expiration_month": 12,
        "address": {
            "city": "San Mateo",
            "country": "USA",
            "region": "CA",
            "line2": "Apartment 7",
            "line1": "741 Douglass St",
            "postal_code": "94114"
        },
        "security_code": "112",
        "type": "PAYMENT_CARD",
        "identity": "IDjDBhJFWm36i6SykV9wV2bP"
    }).save()
card = Payline::PaymentCard.new(
    {
        "name"=> "Fran Le",
        "expiration_year"=> 2020,
        "tags"=> {
            "card_name"=> "Business Card"
        },
        "number"=> "4957030420210454",
        "expiration_month"=> 12,
        "address"=> {
            "city"=> "San Mateo",
            "country"=> "USA",
            "region"=> "CA",
            "line2"=> "Apartment 7",
            "line1"=> "741 Douglass St",
            "postal_code"=> "94114"
        },
        "security_code"=> "112",
        "type"=> "PAYMENT_CARD",
        "identity"=> "IDjDBhJFWm36i6SykV9wV2bP"
    }).save

Example Response:

{
  "id" : "PImmK4gYPPe7QYyqC5n9BCCo",
  "fingerprint" : "FPR-749935287",
  "tags" : {
    "card_name" : "Business Card"
  },
  "expiration_month" : 12,
  "expiration_year" : 2020,
  "last_four" : "0454",
  "brand" : "VISA",
  "card_type" : "UNKNOWN",
  "name" : "Fran Le",
  "address" : {
    "line1" : "741 Douglass St",
    "line2" : "Apartment 7",
    "city" : "San Mateo",
    "region" : "CA",
    "postal_code" : "94114",
    "country" : "USA"
  },
  "address_verification" : "UNKNOWN",
  "security_code_verification" : "UNKNOWN",
  "created_at" : "2017-10-12T01:05:53.88Z",
  "updated_at" : "2017-10-12T01:05:53.88Z",
  "instrument_type" : "PAYMENT_CARD",
  "type" : "PAYMENT_CARD",
  "currency" : "USD",
  "identity" : "IDjDBhJFWm36i6SykV9wV2bP",
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PImmK4gYPPe7QYyqC5n9BCCo"
    },
    "authorizations" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PImmK4gYPPe7QYyqC5n9BCCo/authorizations"
    },
    "identity" : {
      "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP"
    },
    "transfers" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PImmK4gYPPe7QYyqC5n9BCCo/transfers"
    },
    "verifications" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PImmK4gYPPe7QYyqC5n9BCCo/verifications"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    },
    "updates" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PImmK4gYPPe7QYyqC5n9BCCo/updates"
    }
  }
}

Please review our guide on how to tokenize cards via the embedded tokenization form

HTTP Request

POST https://api-test.payline.io/payment_instruments

Request Arguments

Field Type Description
identity string, required ID of the Identity that the card should be associated
type string, required Type of Payment Instrument (for cards input PAYMENT_CARD)
number string, required Credit card account number
security_code string, optional The 3-4 digit security code for the card (i.e. CVV code)
expiration_month integer, required Expiration month (e.g. 12 for December)
expiration_year integer, required 4-digit expiration year
name string, optional Full name of the registered card holder
address object, optional Billing address (Full description of child attributes below)

Address-object Request Arguments

Field Type Description
line1 string, optional First line of the address (max 60 characters)
line2 string, optional Second line of the address (max 60 characters)
city string, optional City (max 20 characters)
region string, optional 2-letter State code
postal_code string, optional Zip or Postal code (max 7 characters)
country string, optional 3-Letter Country code

Create a Bank Account


curl https://api-test.payline.io/payment_instruments \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -d '
    {
        "account_type": "SAVINGS",
        "name": "Fran Lemke",
        "tags": {
            "Bank Account": "Company Account"
        },
        "country": "USA",
        "bank_code": "123123123",
        "account_number": "123123123",
        "type": "BANK_ACCOUNT",
        "identity": "IDteVu9cMtNfZmeTr4pgaDeU"
    }'


import io.payline.payments.ApiClient;
import io.payline.payments.enums.BankAccountType;
import io.payline.payments.forms.BankAccountForm;
import io.payline.payments.interfaces.ApiError;
import io.payline.payments.interfaces.Maybe;
import io.payline.payments.views.BankAccount;
import io.payline.payments.views.Identity;
import java.util.Currency;

BankAccountForm form = BankAccountForm.builder()
        .name("Joe Doe")
        .identity("IDteVu9cMtNfZmeTr4pgaDeU")
        .accountNumber("84012312415")
        .bankCode("840123124")
        .accountType(BankAccountType.SAVINGS)
        .companyName("company name")
        .country("USA")
        .currency(Currency.getInstance("USD"))
        .build();

Maybe<BankAccount> request = api.instruments.post(form);

if (! request.succeeded()) {
    ApiError error = request.error();
    System.out.println(error);
    throw new RuntimeException("API error attempting to create bank account");
}
BankAccount bankAccount = request.view();

<?php
use Payline\Resources\Identity;
use Payline\Resources\BankAccount;

$identity = Identity::retrieve('IDteVu9cMtNfZmeTr4pgaDeU');
$bank_account = new BankAccount(
    array(
        "account_type"=> "SAVINGS",
        "name"=> "Fran Lemke",
        "tags"=> array(
            "Bank Account"=> "Company Account"
        ),
        "country"=> "USA",
        "bank_code"=> "123123123",
        "account_number"=> "123123123",
        "type"=> "BANK_ACCOUNT",
        "identity"=> "IDteVu9cMtNfZmeTr4pgaDeU"
    ));
$bank_account = $identity->createBankAccount($bank_account);


from payline.resources import BankAccount

bank_account = BankAccount(**
    {
        "account_type": "SAVINGS",
        "name": "Fran Lemke",
        "tags": {
            "Bank Account": "Company Account"
        },
        "country": "USA",
        "bank_code": "123123123",
        "account_number": "123123123",
        "type": "BANK_ACCOUNT",
        "identity": "IDteVu9cMtNfZmeTr4pgaDeU"
    }).save()
bank_account = Payline::BankAccount.new(
    {
        "account_type"=> "SAVINGS",
        "name"=> "Fran Lemke",
        "tags"=> {
            "Bank Account"=> "Company Account"
        },
        "country"=> "USA",
        "bank_code"=> "123123123",
        "account_number"=> "123123123",
        "type"=> "BANK_ACCOUNT",
        "identity"=> "IDteVu9cMtNfZmeTr4pgaDeU"
    }).save

Example Response:

{
  "id" : "PI86ok97GjDkWrkKXAJ7kdQs",
  "fingerprint" : "FPR-1215770130",
  "tags" : {
    "Bank Account" : "Company Account"
  },
  "bank_code" : "123123123",
  "country" : "USA",
  "masked_account_number" : "XXXXX3123",
  "name" : "Fran Lemke",
  "account_type" : "SAVINGS",
  "created_at" : "2017-10-12T01:05:48.95Z",
  "updated_at" : "2017-10-12T01:05:48.95Z",
  "instrument_type" : "BANK_ACCOUNT",
  "type" : "BANK_ACCOUNT",
  "currency" : "USD",
  "identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PI86ok97GjDkWrkKXAJ7kdQs"
    },
    "authorizations" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PI86ok97GjDkWrkKXAJ7kdQs/authorizations"
    },
    "identity" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
    },
    "transfers" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PI86ok97GjDkWrkKXAJ7kdQs/transfers"
    },
    "verifications" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PI86ok97GjDkWrkKXAJ7kdQs/verifications"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    }
  }
}

HTTP Request

POST https://api-test.payline.io/payment_instruments

Request Arguments

Field Type Description
account_number string, required Bank account number
bank_code string, required Bank routing number
type string, required Type of Payment Instrument (for bank accounts use BANK_ACCOUNT)
identity string, required ID for the Identity resource which the account is associated
account_type string, required Either CHECKING or SAVINGS
name string, required Account owner’s full name (max 40 characters)

Associate a Token

curl https://api-test.payline.io/payment_instruments \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -d '
    {
        "token": "TKa3oUgM6hZZ3xBEGv89YaHf",
        "type": "TOKEN",
        "identity": "IDteVu9cMtNfZmeTr4pgaDeU"
    }'


import io.payline.payments.forms.*;
import io.payline.payments.views.*;
import io.payline.payments.interfaces.ApiError;
import io.payline.payments.interfaces.Maybe;

TokenAssociationForm tokenForm =  TokenAssociationForm.builder()
    .token("TKa3oUgM6hZZ3xBEGv89YaHf")
    .identity("IDteVu9cMtNfZmeTr4pgaDeU")
    .build();

Maybe<PaymentCard> cardResponse = api.instruments.post(tokenForm);
if (! cardResponse.succeeded()) {
    ApiError error = cardResponse.error();
    System.out.println(error.getCode());
    throw new RuntimeException("API error attempting to create Payment Card");
}
PaymentCard paymentCard = cardResponse.view();

<?php
use Payline\Resources\PaymentInstrument;

$card = new PaymentInstrument(
    array(
        "token"=> "TKa3oUgM6hZZ3xBEGv89YaHf",
        "type"=> "TOKEN",
        "identity"=> "IDteVu9cMtNfZmeTr4pgaDeU"
    ));
$card = $card->save();



from payline.resources import PaymentInstrument

payment_instrument = PaymentInstrument(**
    {
        "token": "TKa3oUgM6hZZ3xBEGv89YaHf",
        "type": "TOKEN",
        "identity": "IDteVu9cMtNfZmeTr4pgaDeU"
    }).save()
card = Payline::PaymentInstrument.new(
    {
        "token"=> "TKa3oUgM6hZZ3xBEGv89YaHf",
        "type"=> "TOKEN",
        "identity"=> "IDteVu9cMtNfZmeTr4pgaDeU"
    }).save

Example Response:

{
  "id" : "PIa3oUgM6hZZ3xBEGv89YaHf",
  "fingerprint" : "FPR-1240667419",
  "tags" : { },
  "expiration_month" : 12,
  "expiration_year" : 2020,
  "last_four" : "0454",
  "brand" : "VISA",
  "card_type" : "UNKNOWN",
  "name" : null,
  "address" : {
    "line1" : "741 Douglass St",
    "line2" : "Apartment 7",
    "city" : "San Mateo",
    "region" : "CA",
    "postal_code" : "94114",
    "country" : "USA"
  },
  "address_verification" : "UNKNOWN",
  "security_code_verification" : "UNKNOWN",
  "created_at" : "2017-10-12T01:06:09.38Z",
  "updated_at" : "2017-10-12T01:06:09.38Z",
  "instrument_type" : "PAYMENT_CARD",
  "type" : "PAYMENT_CARD",
  "currency" : "USD",
  "identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PIa3oUgM6hZZ3xBEGv89YaHf"
    },
    "authorizations" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PIa3oUgM6hZZ3xBEGv89YaHf/authorizations"
    },
    "identity" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
    },
    "transfers" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PIa3oUgM6hZZ3xBEGv89YaHf/transfers"
    },
    "verifications" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PIa3oUgM6hZZ3xBEGv89YaHf/verifications"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    },
    "updates" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PIa3oUgM6hZZ3xBEGv89YaHf/updates"
    }
  }
}

Associate the newly tokenized card or bank with the instrument owner’s Identity.

HTTP Request

POST https://api-test.payline.io/payment_instruments

Request Arguments

Field Type Description
token string, required ID for the Token that was returned via the tokenization client or hosted iframe
type string, required Must pass TOKEN as the value
identity string, required ID for the Identity resource which the account is to be associated

Fetch a Bank Account

curl https://api-test.payline.io/payment_instruments/PI86ok97GjDkWrkKXAJ7kdQs \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \

import io.payline.payments.ApiClient;
import io.payline.payments.views.Instrument;
import io.payline.payments.interfaces.Maybe;

Maybe<Instrument> response = api.paymentInstruments
    .id("PI86ok97GjDkWrkKXAJ7kdQs")
    .get();

if(! response.succeeded()){
    System.out.println(response.error());
    System.out.println(response.error().getDetails());
    throw new RuntimeException("API error attempting to fetch Bank Account");
}

Instrument bankAccountView = response.view();

<?php
use Payline\Resources\PaymentInstrument;

$bank_account = PaymentInstrument::retrieve('PI86ok97GjDkWrkKXAJ7kdQs');



from payline.resources import PaymentInstrument
bank_account = PaymentInstrument.get(id="PI86ok97GjDkWrkKXAJ7kdQs")

bank_account = Payline::BankAccount.retrieve(:id=> "PI86ok97GjDkWrkKXAJ7kdQs")

Example Response:

{
  "id" : "PI86ok97GjDkWrkKXAJ7kdQs",
  "fingerprint" : "FPR-1215770130",
  "tags" : {
    "Display Name" : "Updated Field"
  },
  "bank_code" : "123123123",
  "country" : "USA",
  "masked_account_number" : "XXXXX3123",
  "name" : "Fran Lemke",
  "account_type" : "SAVINGS",
  "created_at" : "2017-10-12T01:05:48.92Z",
  "updated_at" : "2017-10-12T01:05:49.89Z",
  "instrument_type" : "BANK_ACCOUNT",
  "type" : "BANK_ACCOUNT",
  "currency" : "USD",
  "identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PI86ok97GjDkWrkKXAJ7kdQs"
    },
    "authorizations" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PI86ok97GjDkWrkKXAJ7kdQs/authorizations"
    },
    "identity" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
    },
    "transfers" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PI86ok97GjDkWrkKXAJ7kdQs/transfers"
    },
    "verifications" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PI86ok97GjDkWrkKXAJ7kdQs/verifications"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    }
  }
}

Fetch a previously created Payment Instrument that is of type BANK_ACCOUNT

HTTP Request

GET https://api-test.payline.io/payment_instruments/:PAYMENT_INSTRUMENT_ID

URL Parameters

Parameter Description
:PAYMENT_INSTRUMENT_ID ID of the Payment Instrument

Fetch a Credit Card

curl https://api-test.payline.io/payment_instruments/PImmK4gYPPe7QYyqC5n9BCCo \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \

import io.payline.payments.forms.*;
import io.payline.payments.views.*;
import io.payline.payments.interfaces.ApiError;
import io.payline.payments.interfaces.Maybe;

Maybe<PaymentCard> response = api.instruments
  .id("PImmK4gYPPe7QYyqC5n9BCCo")
  .get();

if (! response.succeeded()) {
    ApiError error = response.error();
    System.out.println(error.getCode());
    throw new RuntimeException("API error attempting to fetch Payment Card");
}
PaymentCard card = response.view();

<?php
use Payline\Resources\PaymentInstrument;

$card = PaymentInstrument::retrieve('PImmK4gYPPe7QYyqC5n9BCCo');



from payline.resources import PaymentInstrument
credit_card = PaymentInstrument.get(id="PImmK4gYPPe7QYyqC5n9BCCo")

card = Payline::PaymentCard.retrieve(:id=> "PImmK4gYPPe7QYyqC5n9BCCo")


Example Response:

{
  "id" : "PImmK4gYPPe7QYyqC5n9BCCo",
  "fingerprint" : "FPR-749935287",
  "tags" : {
    "card_name" : "Business Card"
  },
  "expiration_month" : 12,
  "expiration_year" : 2020,
  "last_four" : "0454",
  "brand" : "VISA",
  "card_type" : "UNKNOWN",
  "name" : "Fran Le",
  "address" : {
    "line1" : "741 Douglass St",
    "line2" : "Apartment 7",
    "city" : "San Mateo",
    "region" : "CA",
    "postal_code" : "94114",
    "country" : "USA"
  },
  "address_verification" : "POSTAL_CODE_AND_STREET_MATCH",
  "security_code_verification" : "MATCHED",
  "created_at" : "2017-10-12T01:05:53.84Z",
  "updated_at" : "2017-10-12T01:06:04.25Z",
  "instrument_type" : "PAYMENT_CARD",
  "type" : "PAYMENT_CARD",
  "currency" : "USD",
  "identity" : "IDjDBhJFWm36i6SykV9wV2bP",
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PImmK4gYPPe7QYyqC5n9BCCo"
    },
    "authorizations" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PImmK4gYPPe7QYyqC5n9BCCo/authorizations"
    },
    "identity" : {
      "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP"
    },
    "transfers" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PImmK4gYPPe7QYyqC5n9BCCo/transfers"
    },
    "verifications" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PImmK4gYPPe7QYyqC5n9BCCo/verifications"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    },
    "updates" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PImmK4gYPPe7QYyqC5n9BCCo/updates"
    }
  }
}

Fetch a previously created Payment Instrument that is of type PAYMENT_CARD

HTTP Request

GET https://api-test.payline.io/payment_instruments/:PAYMENT_INSTRUMENT_ID

URL Parameters

Parameter Description
:PAYMENT_INSTRUMENT_ID ID of the Payment Instrument

Check for Card Updates (Account Updater)

Payline works with card networks so that your costumers can continue, without interruption, using your service even if their card has changed due to it being closed, lost, or stolen. When a successful account update record is located, the Payment Instrument will be automatically updated with the new primary account number or new expiration date.

curl https://api-test.payline.io/payment_instruments/PImmK4gYPPe7QYyqC5n9BCCo/updates \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -d '
    {
        "merchant": "MUgv6PAeMd5FDgnFXYRT4RpM"
    }'


<?php



from payline.resources import PaymentCard

card = PaymentCard(**
    {
        "name": "Fran Le",
        "expiration_year": 2020,
        "tags": {
            "card_name": "Business Card"
        },
        "number": "4957030420210454",
        "expiration_month": 12,
        "address": {
            "city": "San Mateo",
            "country": "USA",
            "region": "CA",
            "line2": "Apartment 7",
            "line1": "741 Douglass St",
            "postal_code": "94114"
        },
        "security_code": "112",
        "type": "PAYMENT_CARD",
        "identity": "IDjDBhJFWm36i6SykV9wV2bP"
    }).save()
update = card.update("MUgv6PAeMd5FDgnFXYRT4RpM")


Example Response:

{
  "id" : "IUqvwy8CMHDqKFT7cnaCKg5f",
  "application" : "APupypyYamsTMvnYaanN4EX7",
  "merchant" : "MUgv6PAeMd5FDgnFXYRT4RpM",
  "state" : "PENDING",
  "messages" : [ ],
  "created_at" : "2017-10-12T01:06:12.39Z",
  "updated_at" : "2017-10-12T01:06:12.41Z",
  "payment_instrument" : "PImmK4gYPPe7QYyqC5n9BCCo",
  "trace_id" : "5ae6667e-dc31-45f6-bd7f-bd5934952d5b",
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/updates/IUqvwy8CMHDqKFT7cnaCKg5f"
    },
    "payment_instrument" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PImmK4gYPPe7QYyqC5n9BCCo"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    }
  }
}

Immediate Response

When first making a Post request to the updates endpoint, the state field will either be pending or failed.

  1. PENDING: The initial Account Update request has been approved by the card networks and is awaiting review.

  2. FAILED: Request rejected due to one of the following reasons:

    • Invalid credit card number
    • Invalid expiration date

Subsequent Response

Once Payline receives a response from the card network, the state of the Update resource will return either SUCCEEDED or FAILED. Each Update will also provide a message that details the reason for the outcome. If either an account number or expiration date was found, Payline will automatically update the associated Payment Instrument resource with the new details and the card will be ready for use.

  1. SUCCEEDED Messages:

    • No changes found
    • The account number was changed
    • The expiration date was changed
  2. FAILED Messages:

    • No match found
    • Invalid payment type (often due to unsupported card brands, e.g. Amex)
    • The issuing bank does not participate in the update program
    • The account was closed

HTTP Request

POST https://api-test.payline.io/payment_instruments/:PAYMENT_INSTRUMENT_ID/updates/

Request Arguments

Field Type Description
:MERCHANT_ID string, required ID of the Merchant
:PAYMENT_INSTRUMENT_ID string, required ID of the Payment Instrument

List all Payment Instruments

curl https://api-test.payline.io/payment_instruments \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98
import io.payline.payments.ApiClient;
import io.payline.payments.interfaces.ApiError;
import io.payline.payments.interfaces.Maybe;
import io.payline.payments.lib.Page;
import io.payline.payments.views.Instrument;

Maybe<Page<Instrument>> response = api.instruments.get();

if (! response.succeeded()) {
    ApiError error = response.error();
    System.out.println(error.getCode());
    System.out.println(error.getMessage());
    System.out.println(error.getDetails());
    throw new RuntimeException("API error attempting to list all Payment Instruments");
}

Page<Instrument> page = response.view();

<?php
use Payline\Resources\PaymentInstrument;

$paymentinstruments = PaymentInstrument::getPagination("/payment_instruments");




from payline.resources import PaymentInstrument
payment_instruments = PaymentInstrument.get()

payment_instruments = Payline::PaymentInstruments.retrieve

Example Response:

{
  "_embedded" : {
    "payment_instruments" : [ {
      "id" : "PIa3oUgM6hZZ3xBEGv89YaHf",
      "fingerprint" : "FPR-1240667419",
      "tags" : { },
      "expiration_month" : 12,
      "expiration_year" : 2020,
      "last_four" : "0454",
      "brand" : "VISA",
      "card_type" : "UNKNOWN",
      "name" : null,
      "address" : {
        "line1" : "741 Douglass St",
        "line2" : "Apartment 7",
        "city" : "San Mateo",
        "region" : "CA",
        "postal_code" : "94114",
        "country" : "USA"
      },
      "address_verification" : "UNKNOWN",
      "security_code_verification" : "UNKNOWN",
      "created_at" : "2017-10-12T01:06:09.34Z",
      "updated_at" : "2017-10-12T01:06:09.34Z",
      "instrument_type" : "PAYMENT_CARD",
      "type" : "PAYMENT_CARD",
      "currency" : "USD",
      "identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
      "_links" : {
        "self" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PIa3oUgM6hZZ3xBEGv89YaHf"
        },
        "authorizations" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PIa3oUgM6hZZ3xBEGv89YaHf/authorizations"
        },
        "identity" : {
          "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
        },
        "transfers" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PIa3oUgM6hZZ3xBEGv89YaHf/transfers"
        },
        "verifications" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PIa3oUgM6hZZ3xBEGv89YaHf/verifications"
        },
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        },
        "updates" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PIa3oUgM6hZZ3xBEGv89YaHf/updates"
        }
      }
    }, {
      "id" : "PIvdndRx9wxPgtW6g5ufV1ry",
      "fingerprint" : "FPR-1215770130",
      "tags" : {
        "Bank Account" : "Company Account"
      },
      "bank_code" : "123123123",
      "country" : "USA",
      "masked_account_number" : "XXXXX3123",
      "name" : "Fran Lemke",
      "account_type" : "SAVINGS",
      "created_at" : "2017-10-12T01:05:55.01Z",
      "updated_at" : "2017-10-12T01:05:55.01Z",
      "instrument_type" : "BANK_ACCOUNT",
      "type" : "BANK_ACCOUNT",
      "currency" : "USD",
      "identity" : "IDjDBhJFWm36i6SykV9wV2bP",
      "_links" : {
        "self" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PIvdndRx9wxPgtW6g5ufV1ry"
        },
        "authorizations" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PIvdndRx9wxPgtW6g5ufV1ry/authorizations"
        },
        "identity" : {
          "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP"
        },
        "transfers" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PIvdndRx9wxPgtW6g5ufV1ry/transfers"
        },
        "verifications" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PIvdndRx9wxPgtW6g5ufV1ry/verifications"
        },
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        }
      }
    }, {
      "id" : "PImmK4gYPPe7QYyqC5n9BCCo",
      "fingerprint" : "FPR-749935287",
      "tags" : {
        "card_name" : "Business Card"
      },
      "expiration_month" : 12,
      "expiration_year" : 2020,
      "last_four" : "0454",
      "brand" : "VISA",
      "card_type" : "UNKNOWN",
      "name" : "Fran Le",
      "address" : {
        "line1" : "741 Douglass St",
        "line2" : "Apartment 7",
        "city" : "San Mateo",
        "region" : "CA",
        "postal_code" : "94114",
        "country" : "USA"
      },
      "address_verification" : "POSTAL_CODE_AND_STREET_MATCH",
      "security_code_verification" : "MATCHED",
      "created_at" : "2017-10-12T01:05:53.84Z",
      "updated_at" : "2017-10-12T01:06:04.25Z",
      "instrument_type" : "PAYMENT_CARD",
      "type" : "PAYMENT_CARD",
      "currency" : "USD",
      "identity" : "IDjDBhJFWm36i6SykV9wV2bP",
      "_links" : {
        "self" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PImmK4gYPPe7QYyqC5n9BCCo"
        },
        "authorizations" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PImmK4gYPPe7QYyqC5n9BCCo/authorizations"
        },
        "identity" : {
          "href" : "https://api-test.payline.io:443/identities/IDjDBhJFWm36i6SykV9wV2bP"
        },
        "transfers" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PImmK4gYPPe7QYyqC5n9BCCo/transfers"
        },
        "verifications" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PImmK4gYPPe7QYyqC5n9BCCo/verifications"
        },
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        },
        "updates" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PImmK4gYPPe7QYyqC5n9BCCo/updates"
        }
      }
    }, {
      "id" : "PI86ok97GjDkWrkKXAJ7kdQs",
      "fingerprint" : "FPR-1215770130",
      "tags" : {
        "Display Name" : "Updated Field"
      },
      "bank_code" : "123123123",
      "country" : "USA",
      "masked_account_number" : "XXXXX3123",
      "name" : "Fran Lemke",
      "account_type" : "SAVINGS",
      "created_at" : "2017-10-12T01:05:48.92Z",
      "updated_at" : "2017-10-12T01:05:49.89Z",
      "instrument_type" : "BANK_ACCOUNT",
      "type" : "BANK_ACCOUNT",
      "currency" : "USD",
      "identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
      "_links" : {
        "self" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PI86ok97GjDkWrkKXAJ7kdQs"
        },
        "authorizations" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PI86ok97GjDkWrkKXAJ7kdQs/authorizations"
        },
        "identity" : {
          "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
        },
        "transfers" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PI86ok97GjDkWrkKXAJ7kdQs/transfers"
        },
        "verifications" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PI86ok97GjDkWrkKXAJ7kdQs/verifications"
        },
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io/payment_instruments?offset=0&limit=20&sort=created_at,desc"
    }
  },
  "page" : {
    "offset" : 0,
    "limit" : 20,
    "count" : 4
  }
}

HTTP Request

GET https://api-test.payline.io/payment_instruments

Settlements

A Settlement is a logical construct representing a collection (i.e. batch) of Transfers that are intended to be paid out to a specific Merchant.

Create a Batch Settlement


curl https://api-test.payline.io/identities/IDteVu9cMtNfZmeTr4pgaDeU/settlements \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -d '
    {
        "currency": "USD",
        "tags": {
            "Internal Daily Settlement ID": "21DFASJSAKAS"
        }
    }'

import io.payline.payments.ApiClient;
import io.payline.payments.forms.SettlementForm;
import io.payline.payments.interfaces.Maybe;
import io.payline.payments.views.*;
import java.util.Currency;


Settlement settlement = identity.createSettlement(
  Settlement.builder()
    .currency("USD")
    .build()
);

SettlementForm formSettlement = SettlementForm.builder()
        .currency(Currency.getInstance("USD"))
        .build();

Transfer transfer = api.transfers.id("AUk2C1ctLqeZbkiRJGZhrwxw").get().view();

Maybe<Settlement> response = api.identities.id("IDteVu9cMtNfZmeTr4pgaDeU").settlements.post(formSettlement);

if (! response.succeeded()) {
    throw new RuntimeException("API error attempting to create batch settlement");
}

Settlement settlementBatch = response.view();

<?php
use Payline\Resources\Identity;
use Payline\Resources\Settlement;

$identity = Identity::retrieve('IDteVu9cMtNfZmeTr4pgaDeU');
$settlement = new Settlement(
    array(
        "currency"=> "USD",
        "tags"=> array(
            "Internal Daily Settlement ID"=> "21DFASJSAKAS"
        )
    ));
$settlement = $identity->createSettlement($settlement);



from payline.resources import Identity
from payline.resources import Settlement

identity = Identity.get(id="IDteVu9cMtNfZmeTr4pgaDeU")
settlement = Settlement(**
    {
        "currency": "USD",
        "tags": {
            "Internal Daily Settlement ID": "21DFASJSAKAS"
        }
    })
identity.create_settlement(settlement)
identity = Payline::Identity.retrieve(:id=>"IDteVu9cMtNfZmeTr4pgaDeU")
settlement = identity.create_settlement(
    {
        "currency"=> "USD",
        "tags"=> {
            "Internal Daily Settlement ID"=> "21DFASJSAKAS"
        }
    })

Example Response:

{
  "id" : "STt3KJN4k1f9jCgJuJvZxVF7",
  "tags" : {
    "Internal Daily Settlement ID" : "21DFASJSAKAS"
  },
  "identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
  "currency" : "USD",
  "created_at" : "2017-10-12T01:08:56.90Z",
  "updated_at" : "2017-10-12T01:08:56.92Z",
  "processor" : "DUMMY_V1",
  "total_amount" : 720979,
  "total_fees" : 72101,
  "total_fee" : 72101,
  "net_amount" : 648878,
  "destination" : null,
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/settlements/STt3KJN4k1f9jCgJuJvZxVF7"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    },
    "identity" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
    },
    "funding_transfers" : {
      "href" : "https://api-test.payline.io:443/settlements/STt3KJN4k1f9jCgJuJvZxVF7/funding_transfers"
    },
    "transfers" : {
      "href" : "https://api-test.payline.io:443/settlements/STt3KJN4k1f9jCgJuJvZxVF7/transfers"
    },
    "fees" : {
      "href" : "https://api-test.payline.io:443/settlements/STt3KJN4k1f9jCgJuJvZxVF7/transfers?type=fee"
    },
    "reversals" : {
      "href" : "https://api-test.payline.io:443/settlements/STt3KJN4k1f9jCgJuJvZxVF7/transfers?type=reverse"
    },
    "credits" : {
      "href" : "https://api-test.payline.io:443/settlements/STt3KJN4k1f9jCgJuJvZxVF7/transfers?type=credit"
    },
    "debits" : {
      "href" : "https://api-test.payline.io:443/settlements/STt3KJN4k1f9jCgJuJvZxVF7/transfers?type=debit"
    }
  }
}

Each settlement is comprised of all the Transfers that have a SUCCEEDED state and that have not been previously settled out. In other words, if a merchant has a Transfer in the PENDING state it will not be included in the batch settlement. In addition, Settlements will include any refunded Transfers as a deduction. The total_amount minus the total_fee equals the net_amount (the amount in cents that will be deposited into your merchant’s bank account).

HTTP Request

POST https://api-test.payline.io/identities/:IDENTITY_ID/settlements

URL Parameters

Parameter Description
:IDENTITY_ID ID of the Identity for the merchant you wish to settle out

Request Arguments

Field Type Description
currency integer, required 3-letter currency code that the funds should be deposited (e.g. USD)
tags object, optional Key value pair for annotating custom meta data (e.g. order numbers)

Fetch a Batch Settlement



curl https://api-test.payline.io/settlements/STt3KJN4k1f9jCgJuJvZxVF7 \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \

import io.payline.payments.ApiClient;
import io.payline.payments.interfaces.Maybe;
import io.payline.payments.views.Settlement;

Maybe<Settlement> response = api.settlements
  .id("STt3KJN4k1f9jCgJuJvZxVF7")
  .get();

if(! response.succeeded()){
    System.out.println(response.error());
    System.out.println(response.error().getDetails());
    throw new RuntimeException("API error attempting to fetch settlement");
}

Settlement settlementView = response.view();

<?php
use Payline\Resources\Settlement;

$settlement = Settlement::retrieve('STt3KJN4k1f9jCgJuJvZxVF7');



from payline.resources import Settlements
settlement = Settlements.get(id="STt3KJN4k1f9jCgJuJvZxVF7")

settlement = Payline::Settlement.retrieve(:id=>"STt3KJN4k1f9jCgJuJvZxVF7")

Example Response:

{
  "id" : "STt3KJN4k1f9jCgJuJvZxVF7",
  "tags" : {
    "Internal Daily Settlement ID" : "21DFASJSAKAS"
  },
  "identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
  "currency" : "USD",
  "created_at" : "2017-10-12T01:08:56.87Z",
  "updated_at" : "2017-10-12T01:08:58.23Z",
  "processor" : "DUMMY_V1",
  "total_amount" : 720979,
  "total_fees" : 72101,
  "total_fee" : 72101,
  "net_amount" : 648878,
  "destination" : "PI86ok97GjDkWrkKXAJ7kdQs",
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/settlements/STt3KJN4k1f9jCgJuJvZxVF7"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    },
    "identity" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
    },
    "funding_transfers" : {
      "href" : "https://api-test.payline.io:443/settlements/STt3KJN4k1f9jCgJuJvZxVF7/funding_transfers"
    },
    "transfers" : {
      "href" : "https://api-test.payline.io:443/settlements/STt3KJN4k1f9jCgJuJvZxVF7/transfers"
    },
    "fees" : {
      "href" : "https://api-test.payline.io:443/settlements/STt3KJN4k1f9jCgJuJvZxVF7/transfers?type=fee"
    },
    "reversals" : {
      "href" : "https://api-test.payline.io:443/settlements/STt3KJN4k1f9jCgJuJvZxVF7/transfers?type=reverse"
    },
    "credits" : {
      "href" : "https://api-test.payline.io:443/settlements/STt3KJN4k1f9jCgJuJvZxVF7/transfers?type=credit"
    },
    "debits" : {
      "href" : "https://api-test.payline.io:443/settlements/STt3KJN4k1f9jCgJuJvZxVF7/transfers?type=debit"
    }
  }
}

Fetch a previously created Settlement.

HTTP Request

POST https://api-test.payline.io/settlements/:SETTLEMENT_ID/

URL Parameters

Parameter Description
:SETTLEMENT_ID ID of the Settlement

List all Settlements

curl https://api-test.payline.io/settlements/ \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98

import io.payline.payments.ApiClient;
import io.payline.payments.interfaces.ApiError;
import io.payline.payments.interfaces.Maybe;
import io.payline.payments.lib.Page;
import io.payline.payments.views.Settlement;

Maybe<Page<Settlement>> request = api.settlements.get();

if (! request.succeeded()) {
    ApiError error = request.error();
    System.out.println(error.getCode());
    System.out.println(error.getMessage());
    System.out.println(error.getDetails());
    throw new RuntimeException("API error attempting to list all Settlements");
}

Page<Settlement> page = request.view();

<?php
use Payline\Resources\Settlement;

$settlements = Settlement::getPagination("/settlements");




from payline.resources import Settlement
settlements = Settlement.get()

settlements = Payline::Settlement.retrieve

Example Response:

{
  "_embedded" : {
    "settlements" : [ {
      "id" : "STt3KJN4k1f9jCgJuJvZxVF7",
      "tags" : {
        "Internal Daily Settlement ID" : "21DFASJSAKAS"
      },
      "identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
      "currency" : "USD",
      "created_at" : "2017-10-12T01:08:56.87Z",
      "updated_at" : "2017-10-12T01:08:58.23Z",
      "processor" : "DUMMY_V1",
      "total_amount" : 720979,
      "total_fees" : 72101,
      "total_fee" : 72101,
      "net_amount" : 648878,
      "destination" : "PI86ok97GjDkWrkKXAJ7kdQs",
      "_links" : {
        "self" : {
          "href" : "https://api-test.payline.io:443/settlements/STt3KJN4k1f9jCgJuJvZxVF7"
        },
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        },
        "identity" : {
          "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
        },
        "funding_transfers" : {
          "href" : "https://api-test.payline.io:443/settlements/STt3KJN4k1f9jCgJuJvZxVF7/funding_transfers"
        },
        "transfers" : {
          "href" : "https://api-test.payline.io:443/settlements/STt3KJN4k1f9jCgJuJvZxVF7/transfers"
        },
        "fees" : {
          "href" : "https://api-test.payline.io:443/settlements/STt3KJN4k1f9jCgJuJvZxVF7/transfers?type=fee"
        },
        "reversals" : {
          "href" : "https://api-test.payline.io:443/settlements/STt3KJN4k1f9jCgJuJvZxVF7/transfers?type=reverse"
        },
        "credits" : {
          "href" : "https://api-test.payline.io:443/settlements/STt3KJN4k1f9jCgJuJvZxVF7/transfers?type=credit"
        },
        "debits" : {
          "href" : "https://api-test.payline.io:443/settlements/STt3KJN4k1f9jCgJuJvZxVF7/transfers?type=debit"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io/settlements?offset=0&limit=20&sort=created_at,desc"
    }
  },
  "page" : {
    "offset" : 0,
    "limit" : 20,
    "count" : 1
  }
}

List the Transfers of type CREDIT that result from issuing funding instructions for the Settlement.

HTTP Request

GET https://api-test.payline.io/settlements/:SETTLEMENT_ID/funding_transfers

URL Parameters

Parameter Description
:SETTLEMENT_ID ID of the Settlement

List Funding Transfers in a Batch Settlement

curl https://api-test.payline.io/settlements/STt3KJN4k1f9jCgJuJvZxVF7/funding_transfers \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98

Settlement settlement = client.settlementsClient().fetch("STt3KJN4k1f9jCgJuJvZxVF7");
  settlement.fundingTransfersClient().<Resources<Transfer>>resourcesIterator()
    .forEachRemaining(page -> {
      Collection<Transfer> transfers = page.getContent();
      transfers.forEach(transfer ->
     // do something
      );
    });
}
<?php
use Payline\Resources\Settlement;

$settlement = Settlement::retrieve('STt3KJN4k1f9jCgJuJvZxVF7');
$settlements = Settlement::getPagination($settlement->getHref("funding_transfers"));



from payline.resources import Settlements
settlement = Settlement.get(id="STt3KJN4k1f9jCgJuJvZxVF7")
transfers = settlement.funding_transfers

settlement = Payline::Settlement.retrieve(:id=>"STt3KJN4k1f9jCgJuJvZxVF7")
transfers = settlement.funding_transfers

Example Response:

{
  "_embedded" : {
    "transfers" : [ {
      "id" : "TRuSk6aJhnZVEzkWHYf8LyKA",
      "amount" : 648878,
      "tags" : {
        "Internal Daily Settlement ID" : "21DFASJSAKAS"
      },
      "state" : "PENDING",
      "trace_id" : "f0100e26-6051-49e7-bdb5-ca5d930b78fe",
      "currency" : "USD",
      "application" : "APupypyYamsTMvnYaanN4EX7",
      "source" : "PInTQxiXCNw5m9Ru3qQ1X4di",
      "destination" : "PI86ok97GjDkWrkKXAJ7kdQs",
      "ready_to_settle_at" : null,
      "fee" : 0,
      "statement_descriptor" : null,
      "type" : "CREDIT",
      "messages" : [ ],
      "raw" : null,
      "created_at" : "2017-10-12T01:08:57.92Z",
      "updated_at" : "2017-10-12T01:08:58.17Z",
      "idempotency_id" : null,
      "merchant_identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
      "subtype" : "API",
      "_links" : {
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        },
        "self" : {
          "href" : "https://api-test.payline.io:443/transfers/TRuSk6aJhnZVEzkWHYf8LyKA"
        },
        "payment_instruments" : {
          "href" : "https://api-test.payline.io:443/transfers/TRuSk6aJhnZVEzkWHYf8LyKA/payment_instruments"
        },
        "merchant_identity" : {
          "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
        },
        "reversals" : {
          "href" : "https://api-test.payline.io:443/transfers/TRuSk6aJhnZVEzkWHYf8LyKA/reversals"
        },
        "fees" : {
          "href" : "https://api-test.payline.io:443/transfers/TRuSk6aJhnZVEzkWHYf8LyKA/fees"
        },
        "disputes" : {
          "href" : "https://api-test.payline.io:443/transfers/TRuSk6aJhnZVEzkWHYf8LyKA/disputes"
        },
        "source" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PInTQxiXCNw5m9Ru3qQ1X4di"
        },
        "destination" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PI86ok97GjDkWrkKXAJ7kdQs"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io/settlements/STt3KJN4k1f9jCgJuJvZxVF7/funding_transfers?offset=0&limit=20&sort=created_at,desc"
    }
  },
  "page" : {
    "offset" : 0,
    "limit" : 20,
    "count" : 1
  }
}

List the Transfers of type CREDIT that result from issuing a Settlement.

HTTP Request

GET https://api-test.payline.io/settlements/:SETTLEMENT_ID/funding_transfers

URL Parameters

Parameter Description
:SETTLEMENT_ID ID of the Settlement

List Transfers in a Batch Settlement


curl https://api-test.payline.io/settlements/STt3KJN4k1f9jCgJuJvZxVF7/transfers \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98

Settlement settlement = client.settlementsClient().fetch("STt3KJN4k1f9jCgJuJvZxVF7");
    settlement.transfersClient().<Resources<Transfer>>resourcesIterator()
      .forEachRemaining(page -> {
        Collection<Transfer> transfers = page.getContent();
        transfers.forEach(transfer ->
       // do something
        );
      });
  }



<?php
use Payline\Resources\Settlement;

$settlement = Settlement::retrieve('STt3KJN4k1f9jCgJuJvZxVF7');
$settlements = Settlement::getPagination($settlement->getHref("transfers"));




settlement = Payline::Settlement.retrieve(:id=>"STt3KJN4k1f9jCgJuJvZxVF7")
transfers = settlement.transfers

Example Response:

{
  "_embedded" : {
    "transfers" : [ {
      "id" : "TR2uoKmNWvZzoX54hL76U1gT",
      "amount" : 66090,
      "tags" : { },
      "state" : "SUCCEEDED",
      "trace_id" : "a4815561-d40e-4377-8f4e-8f6e9ff1357f",
      "currency" : "USD",
      "application" : "APupypyYamsTMvnYaanN4EX7",
      "source" : "PInTQxiXCNw5m9Ru3qQ1X4di",
      "destination" : "PImeyUrPRXi8zHywWXKHYx3x",
      "ready_to_settle_at" : "2017-10-12T01:08:55.56Z",
      "fee" : 0,
      "statement_descriptor" : null,
      "type" : "FEE",
      "messages" : [ ],
      "raw" : null,
      "created_at" : "2017-10-12T01:08:55.21Z",
      "updated_at" : "2017-10-12T01:08:55.55Z",
      "idempotency_id" : null,
      "merchant_identity" : "IDxsNEgCXTAM8eYDuXL3zR7z",
      "subtype" : "APPLICATION_FEE",
      "_links" : {
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        },
        "self" : {
          "href" : "https://api-test.payline.io:443/transfers/TR2uoKmNWvZzoX54hL76U1gT"
        },
        "payment_instruments" : {
          "href" : "https://api-test.payline.io:443/transfers/TR2uoKmNWvZzoX54hL76U1gT/payment_instruments"
        },
        "merchant_identity" : {
          "href" : "https://api-test.payline.io:443/identities/IDxsNEgCXTAM8eYDuXL3zR7z"
        },
        "reversals" : {
          "href" : "https://api-test.payline.io:443/transfers/TR2uoKmNWvZzoX54hL76U1gT/reversals"
        },
        "fees" : {
          "href" : "https://api-test.payline.io:443/transfers/TR2uoKmNWvZzoX54hL76U1gT/fees"
        },
        "disputes" : {
          "href" : "https://api-test.payline.io:443/transfers/TR2uoKmNWvZzoX54hL76U1gT/disputes"
        },
        "source" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PInTQxiXCNw5m9Ru3qQ1X4di"
        },
        "destination" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PImeyUrPRXi8zHywWXKHYx3x"
        }
      }
    }, {
      "id" : "TRoBiG8JVAiqtwC4AYhQZhpe",
      "amount" : 5998,
      "tags" : { },
      "state" : "SUCCEEDED",
      "trace_id" : "a9af8ce3-2dff-4e3d-9924-6068586e9027",
      "currency" : "USD",
      "application" : "APupypyYamsTMvnYaanN4EX7",
      "source" : "PInTQxiXCNw5m9Ru3qQ1X4di",
      "destination" : "PImeyUrPRXi8zHywWXKHYx3x",
      "ready_to_settle_at" : "2017-10-12T01:08:55.13Z",
      "fee" : 0,
      "statement_descriptor" : null,
      "type" : "FEE",
      "messages" : [ ],
      "raw" : null,
      "created_at" : "2017-10-12T01:08:54.75Z",
      "updated_at" : "2017-10-12T01:08:55.12Z",
      "idempotency_id" : null,
      "merchant_identity" : "IDxsNEgCXTAM8eYDuXL3zR7z",
      "subtype" : "APPLICATION_FEE",
      "_links" : {
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        },
        "self" : {
          "href" : "https://api-test.payline.io:443/transfers/TRoBiG8JVAiqtwC4AYhQZhpe"
        },
        "payment_instruments" : {
          "href" : "https://api-test.payline.io:443/transfers/TRoBiG8JVAiqtwC4AYhQZhpe/payment_instruments"
        },
        "merchant_identity" : {
          "href" : "https://api-test.payline.io:443/identities/IDxsNEgCXTAM8eYDuXL3zR7z"
        },
        "reversals" : {
          "href" : "https://api-test.payline.io:443/transfers/TRoBiG8JVAiqtwC4AYhQZhpe/reversals"
        },
        "fees" : {
          "href" : "https://api-test.payline.io:443/transfers/TRoBiG8JVAiqtwC4AYhQZhpe/fees"
        },
        "disputes" : {
          "href" : "https://api-test.payline.io:443/transfers/TRoBiG8JVAiqtwC4AYhQZhpe/disputes"
        },
        "source" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PInTQxiXCNw5m9Ru3qQ1X4di"
        },
        "destination" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PImeyUrPRXi8zHywWXKHYx3x"
        }
      }
    }, {
      "id" : "TRp5seZMtkor6vyCuLpnmxds",
      "amount" : 13,
      "tags" : { },
      "state" : "SUCCEEDED",
      "trace_id" : "5fc5198e-32d2-4720-a09c-71eb25e33dc6",
      "currency" : "USD",
      "application" : "APupypyYamsTMvnYaanN4EX7",
      "source" : "PInTQxiXCNw5m9Ru3qQ1X4di",
      "destination" : "PIrtZ6CL7w8yYvAXYe92b1vs",
      "ready_to_settle_at" : "2017-10-12T01:08:54.66Z",
      "fee" : 0,
      "statement_descriptor" : null,
      "type" : "FEE",
      "messages" : [ ],
      "raw" : null,
      "created_at" : "2017-10-12T01:08:54.30Z",
      "updated_at" : "2017-10-12T01:08:54.65Z",
      "idempotency_id" : null,
      "merchant_identity" : "IDjFtXt19dt59nd6jyyF7VuF",
      "subtype" : "PLATFORM_FEE",
      "_links" : {
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        },
        "self" : {
          "href" : "https://api-test.payline.io:443/transfers/TRp5seZMtkor6vyCuLpnmxds"
        },
        "payment_instruments" : {
          "href" : "https://api-test.payline.io:443/transfers/TRp5seZMtkor6vyCuLpnmxds/payment_instruments"
        },
        "merchant_identity" : {
          "href" : "https://api-test.payline.io:443/identities/IDjFtXt19dt59nd6jyyF7VuF"
        },
        "reversals" : {
          "href" : "https://api-test.payline.io:443/transfers/TRp5seZMtkor6vyCuLpnmxds/reversals"
        },
        "fees" : {
          "href" : "https://api-test.payline.io:443/transfers/TRp5seZMtkor6vyCuLpnmxds/fees"
        },
        "disputes" : {
          "href" : "https://api-test.payline.io:443/transfers/TRp5seZMtkor6vyCuLpnmxds/disputes"
        },
        "source" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PInTQxiXCNw5m9Ru3qQ1X4di"
        },
        "destination" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PIrtZ6CL7w8yYvAXYe92b1vs"
        }
      }
    }, {
      "id" : "TR4Bgv1VHDePfYZdpUfUv9z6",
      "amount" : 100,
      "tags" : { },
      "state" : "SUCCEEDED",
      "trace_id" : "2ff94b68-09bb-42dc-9f9e-76f4f845a874",
      "currency" : "USD",
      "application" : "APupypyYamsTMvnYaanN4EX7",
      "source" : "PImmK4gYPPe7QYyqC5n9BCCo",
      "destination" : "PInTQxiXCNw5m9Ru3qQ1X4di",
      "ready_to_settle_at" : "2017-10-12T01:08:54.27Z",
      "fee" : 10,
      "statement_descriptor" : "PLD*PETES COFFEE",
      "type" : "DEBIT",
      "messages" : [ ],
      "raw" : null,
      "created_at" : "2017-10-12T01:06:06.30Z",
      "updated_at" : "2017-10-12T01:07:01.52Z",
      "idempotency_id" : null,
      "merchant_identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
      "subtype" : "API",
      "_links" : {
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        },
        "self" : {
          "href" : "https://api-test.payline.io:443/transfers/TR4Bgv1VHDePfYZdpUfUv9z6"
        },
        "payment_instruments" : {
          "href" : "https://api-test.payline.io:443/transfers/TR4Bgv1VHDePfYZdpUfUv9z6/payment_instruments"
        },
        "merchant_identity" : {
          "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
        },
        "reversals" : {
          "href" : "https://api-test.payline.io:443/transfers/TR4Bgv1VHDePfYZdpUfUv9z6/reversals"
        },
        "fees" : {
          "href" : "https://api-test.payline.io:443/transfers/TR4Bgv1VHDePfYZdpUfUv9z6/fees"
        },
        "disputes" : {
          "href" : "https://api-test.payline.io:443/transfers/TR4Bgv1VHDePfYZdpUfUv9z6/disputes"
        },
        "source" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PImmK4gYPPe7QYyqC5n9BCCo"
        },
        "destination" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PInTQxiXCNw5m9Ru3qQ1X4di"
        }
      }
    }, {
      "id" : "TRxtX2XR8vDhRLm3i9B174kF",
      "amount" : 660898,
      "tags" : {
        "order_number" : "21DFASJSAKAS"
      },
      "state" : "SUCCEEDED",
      "trace_id" : "d81f20ae-609e-4f61-8240-02310e860d74",
      "currency" : "USD",
      "application" : "APupypyYamsTMvnYaanN4EX7",
      "source" : "PIvdndRx9wxPgtW6g5ufV1ry",
      "destination" : "PInTQxiXCNw5m9Ru3qQ1X4di",
      "ready_to_settle_at" : "2017-10-12T01:08:55.17Z",
      "fee" : 66090,
      "statement_descriptor" : "PLD*PETES COFFEE",
      "type" : "DEBIT",
      "messages" : [ ],
      "raw" : null,
      "created_at" : "2017-10-12T01:05:57.08Z",
      "updated_at" : "2017-10-12T01:06:02.16Z",
      "idempotency_id" : "9a882b2f2bf341f8aa4e7bc1d81f2b92",
      "merchant_identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
      "subtype" : "API",
      "_links" : {
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        },
        "self" : {
          "href" : "https://api-test.payline.io:443/transfers/TRxtX2XR8vDhRLm3i9B174kF"
        },
        "payment_instruments" : {
          "href" : "https://api-test.payline.io:443/transfers/TRxtX2XR8vDhRLm3i9B174kF/payment_instruments"
        },
        "merchant_identity" : {
          "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
        },
        "reversals" : {
          "href" : "https://api-test.payline.io:443/transfers/TRxtX2XR8vDhRLm3i9B174kF/reversals"
        },
        "fees" : {
          "href" : "https://api-test.payline.io:443/transfers/TRxtX2XR8vDhRLm3i9B174kF/fees"
        },
        "disputes" : {
          "href" : "https://api-test.payline.io:443/transfers/TRxtX2XR8vDhRLm3i9B174kF/disputes"
        },
        "source" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PIvdndRx9wxPgtW6g5ufV1ry"
        },
        "destination" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PInTQxiXCNw5m9Ru3qQ1X4di"
        }
      }
    }, {
      "id" : "TRop7MdiZpjR7yX2Rw9ztjK1",
      "amount" : 59981,
      "tags" : {
        "order_number" : "12121212"
      },
      "state" : "SUCCEEDED",
      "trace_id" : "a6905a8b-e496-4132-a88f-1db47309278f",
      "currency" : "USD",
      "application" : "APupypyYamsTMvnYaanN4EX7",
      "source" : "PIvdndRx9wxPgtW6g5ufV1ry",
      "destination" : "PInTQxiXCNw5m9Ru3qQ1X4di",
      "ready_to_settle_at" : "2017-10-12T01:08:54.71Z",
      "fee" : 5998,
      "statement_descriptor" : "PLD*PETES COFFEE",
      "type" : "DEBIT",
      "messages" : [ ],
      "raw" : null,
      "created_at" : "2017-10-12T01:05:56.13Z",
      "updated_at" : "2017-10-12T01:06:33.70Z",
      "idempotency_id" : null,
      "merchant_identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
      "subtype" : "API",
      "_links" : {
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        },
        "self" : {
          "href" : "https://api-test.payline.io:443/transfers/TRop7MdiZpjR7yX2Rw9ztjK1"
        },
        "payment_instruments" : {
          "href" : "https://api-test.payline.io:443/transfers/TRop7MdiZpjR7yX2Rw9ztjK1/payment_instruments"
        },
        "merchant_identity" : {
          "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
        },
        "reversals" : {
          "href" : "https://api-test.payline.io:443/transfers/TRop7MdiZpjR7yX2Rw9ztjK1/reversals"
        },
        "fees" : {
          "href" : "https://api-test.payline.io:443/transfers/TRop7MdiZpjR7yX2Rw9ztjK1/fees"
        },
        "disputes" : {
          "href" : "https://api-test.payline.io:443/transfers/TRop7MdiZpjR7yX2Rw9ztjK1/disputes"
        },
        "source" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PIvdndRx9wxPgtW6g5ufV1ry"
        },
        "destination" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PInTQxiXCNw5m9Ru3qQ1X4di"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io/settlements/STt3KJN4k1f9jCgJuJvZxVF7/transfers?offset=0&limit=20&sort=created_at,desc"
    }
  },
  "page" : {
    "offset" : 0,
    "limit" : 20,
    "count" : 6
  }
}

List the batch of Transfers of type DEBIT and REFUND that comprise the net settled amount of a Settlement.

HTTP Request

GET https://api-test.payline.io/settlements/:SETTLEMENT_ID/transfers

URL Parameters

Parameter Description
:SETTLEMENT_ID ID of the Settlement

Transfers

A Transfer represents any flow of funds either to or from a Payment Instrument. For example, a Transfer is a credit to a bank account refund to a card.

A Transfer can have one of three types: Debit, Credit, or Reversal. Each type indicates a different funds flow. For example:

Transfers can have four possible states values: PENDING, SUCCEEDED, FAILED, or CANCELED.

By default, Transfers will be in a PENDING state and will eventually (typically within an hour) update to SUCCEEDED.

ready_to_settle_at field can have 2 possible values:

  1. null: Funds have been captured, but are not yet ready to be paid out
  2. TIMESTAMP: A UTC timestamp that specifies when the funds will be available to be payout out. Once in the past, the Transfer will be eligible for inclusion in a batch Settlement.

Debit a Bank Account (ie eCheck)

Returns: Note eCheck transactions can be rejected for up to 60 days for a variety of reasons including insufficient funds, closed accounts, or a revoked authorization (i.e. dispute). When a return occurs a Transfer of type REVERSAL with a subtype SYSTEM is automatically created and will negatively impact the future settlement.

curl https://api-test.payline.io/transfers \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -d '
    {
        "fee": 5998,
        "source": "PIvdndRx9wxPgtW6g5ufV1ry",
        "merchant_identity": "IDteVu9cMtNfZmeTr4pgaDeU",
        "tags": {
            "order_number": "21DFASJSAKAS"
        },
        "currency": "USD",
        "amount": 59981
    }'


import io.payline.payments.forms.*;
import io.payline.payments.views.*;
import io.payline.payments.interfaces.ApiError;
import io.payline.payments.interfaces.Maybe;
import com.google.common.collect.ImmutableMap;
import java.util.Currency;

TransferForm form = TransferForm.builder()
        .amount(100L)
        .currency(Currency.getInstance("USD"))
        .source("PImmK4gYPPe7QYyqC5n9BCCo}")
        .merchantIdentity("IDteVu9cMtNfZmeTr4pgaDeU")
        .tags(ImmutableMap.of("order_number", "21DFASJSAKAS"))
        .build();

Maybe<Transfer> response = api.transfers.post(form);
if (! response.succeeded()) {
    ApiError error = response.error();
    System.out.println(error.getCode());
    throw new RuntimeException("API error attempting to debit Bank Account");
}
Transfer transfer = response.view();

<?php
use Payline\Resources\Transfer;

$debit = new Transfer(
    array(
        "fee"=> 5998,
        "source"=> "PIvdndRx9wxPgtW6g5ufV1ry",
        "merchant_identity"=> "IDteVu9cMtNfZmeTr4pgaDeU",
        "tags"=> array(
            "order_number"=> "21DFASJSAKAS"
        ),
        "currency"=> "USD",
        "amount"=> 59981
    ));
$debit = $debit->save();



from payline.resources import Transfer

payout = Transfer(**
    {
        "fee": 5998,
        "source": "PIvdndRx9wxPgtW6g5ufV1ry",
        "merchant_identity": "IDteVu9cMtNfZmeTr4pgaDeU",
        "tags": {
            "order_number": "21DFASJSAKAS"
        },
        "currency": "USD",
        "amount": 59981
    }).save()

Payline::Transfer.new(
    {
        "fee"=> 5998,
        "source"=> "PIvdndRx9wxPgtW6g5ufV1ry",
        "merchant_identity"=> "IDteVu9cMtNfZmeTr4pgaDeU",
        "tags"=> {
            "order_number"=> "21DFASJSAKAS"
        },
        "currency"=> "USD",
        "amount"=> 59981
    }).save

Example Response:

{
  "id" : "TRop7MdiZpjR7yX2Rw9ztjK1",
  "amount" : 59981,
  "tags" : {
    "order_number" : "21DFASJSAKAS"
  },
  "state" : "PENDING",
  "trace_id" : "a6905a8b-e496-4132-a88f-1db47309278f",
  "currency" : "USD",
  "application" : "APupypyYamsTMvnYaanN4EX7",
  "source" : "PIvdndRx9wxPgtW6g5ufV1ry",
  "destination" : "PInTQxiXCNw5m9Ru3qQ1X4di",
  "ready_to_settle_at" : null,
  "fee" : 5998,
  "statement_descriptor" : "PLD*PETES COFFEE",
  "type" : "DEBIT",
  "messages" : [ ],
  "raw" : null,
  "created_at" : "2017-10-12T01:05:56.18Z",
  "updated_at" : "2017-10-12T01:05:56.26Z",
  "idempotency_id" : null,
  "merchant_identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
  "subtype" : "API",
  "_links" : {
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    },
    "self" : {
      "href" : "https://api-test.payline.io:443/transfers/TRop7MdiZpjR7yX2Rw9ztjK1"
    },
    "payment_instruments" : {
      "href" : "https://api-test.payline.io:443/transfers/TRop7MdiZpjR7yX2Rw9ztjK1/payment_instruments"
    },
    "merchant_identity" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
    },
    "reversals" : {
      "href" : "https://api-test.payline.io:443/transfers/TRop7MdiZpjR7yX2Rw9ztjK1/reversals"
    },
    "fees" : {
      "href" : "https://api-test.payline.io:443/transfers/TRop7MdiZpjR7yX2Rw9ztjK1/fees"
    },
    "disputes" : {
      "href" : "https://api-test.payline.io:443/transfers/TRop7MdiZpjR7yX2Rw9ztjK1/disputes"
    },
    "source" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PIvdndRx9wxPgtW6g5ufV1ry"
    },
    "destination" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PInTQxiXCNw5m9Ru3qQ1X4di"
    }
  }
}

A Transfer representing a customer payment where funds are obtained from a bank account (i.e. ACH Debit, eCheck). These specific Transfers are distinguished by their type which return DEBIT.

Learn how to prevent duplicate transfers by passing an idempotency ID in the payload.

HTTP Request

POST https://api-test.payline.io/transfers

Request Arguments

Field Type Description
source string, required ID of the Payment Instrument that will be debited
merchant_identity string, required Identity ID of the merchant whom you’re charging on behalf of
amount integer, required The total amount that will be debited in cents (e.g. 100 cents to debit $1.00)
fee integer, optional The amount of the Transfer you would like to collect as your fee in cents. Defaults to zero (Must be less than or equal to the amount)
currency string, required 3-letter ISO code designating the currency of the Transfers (e.g. USD)
tags object, optional Key value pair for annotating custom meta data (e.g. order numbers)
idempotency_id string, optional A randomly generated value that you want associated with the request

Fetch a Transfer


curl https://api-test.payline.io/transfers/TRop7MdiZpjR7yX2Rw9ztjK1 \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98


import io.payline.payments.ApiClient;
import io.payline.payments.interfaces.Maybe;
import io.payline.payments.views.Transfer;

Maybe<Transfer> response = api.transfers
    .id("TRop7MdiZpjR7yX2Rw9ztjK1")
    .get();

if(! response.succeeded()){
    System.out.println(response.error());
    System.out.println(response.error().getDetails());
    throw new RuntimeException("API error attempting to fetch Transfer");
}

Transfer transferView = response.view();

<?php
use Payline\Resources\Transfer;

$transfer = Transfer::retrieve('TRop7MdiZpjR7yX2Rw9ztjK1');





from payline.resources import Transfer
transfer = Transfer.get(id="TRop7MdiZpjR7yX2Rw9ztjK1")

transfer = Payline::Transfer.retrieve(:id=> "TRop7MdiZpjR7yX2Rw9ztjK1")

Example Response:

{
  "id" : "TRop7MdiZpjR7yX2Rw9ztjK1",
  "amount" : 59981,
  "tags" : {
    "order_number" : "21DFASJSAKAS"
  },
  "state" : "SUCCEEDED",
  "trace_id" : "a6905a8b-e496-4132-a88f-1db47309278f",
  "currency" : "USD",
  "application" : "APupypyYamsTMvnYaanN4EX7",
  "source" : "PIvdndRx9wxPgtW6g5ufV1ry",
  "destination" : "PInTQxiXCNw5m9Ru3qQ1X4di",
  "ready_to_settle_at" : null,
  "fee" : 5998,
  "statement_descriptor" : "PLD*PETES COFFEE",
  "type" : "DEBIT",
  "messages" : [ ],
  "raw" : null,
  "created_at" : "2017-10-12T01:05:56.13Z",
  "updated_at" : "2017-10-12T01:06:02.36Z",
  "idempotency_id" : null,
  "merchant_identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
  "subtype" : "API",
  "_links" : {
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    },
    "self" : {
      "href" : "https://api-test.payline.io:443/transfers/TRop7MdiZpjR7yX2Rw9ztjK1"
    },
    "payment_instruments" : {
      "href" : "https://api-test.payline.io:443/transfers/TRop7MdiZpjR7yX2Rw9ztjK1/payment_instruments"
    },
    "merchant_identity" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
    },
    "reversals" : {
      "href" : "https://api-test.payline.io:443/transfers/TRop7MdiZpjR7yX2Rw9ztjK1/reversals"
    },
    "fees" : {
      "href" : "https://api-test.payline.io:443/transfers/TRop7MdiZpjR7yX2Rw9ztjK1/fees"
    },
    "disputes" : {
      "href" : "https://api-test.payline.io:443/transfers/TRop7MdiZpjR7yX2Rw9ztjK1/disputes"
    },
    "source" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PIvdndRx9wxPgtW6g5ufV1ry"
    },
    "destination" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PInTQxiXCNw5m9Ru3qQ1X4di"
    }
  }
}

HTTP Request

GET https://api-test.payline.io/transfers/:TRANSFER_ID

URL Parameters

Parameter Description
:TRANSFER_ID ID of the Transfer

Refund a Debit


curl https://api-test.payline.io/transfers/TRop7MdiZpjR7yX2Rw9ztjK1/reversals \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -d  '
                  {
                  "refund_amount" : 100
                  }
                '


import io.payline.payments.processing.client.model.Refund;

Refund refund = transfer.reverse(100L);

<?php
use Payline\Resources\Transfer;

$debit = Transfer::retrieve('TRop7MdiZpjR7yX2Rw9ztjK1');
$refund = $debit->reverse(11);



from payline.resources import Transfer

transfer = Transfer.get(id="TRop7MdiZpjR7yX2Rw9ztjK1")
transfer.reverse(**
                  {
                  "refund_amount" : 100
                  }
                )
transfer = Payline::Transfer.retrieve(:id=> "TRop7MdiZpjR7yX2Rw9ztjK1")

refund = transfer.reverse(100)

Example Response:

{
  "id" : "TRrcvcSgvL6XkjsUfVLUhqh5",
  "amount" : 497912,
  "tags" : { },
  "state" : "SUCCEEDED",
  "trace_id" : "cc0fa55c-8001-49be-ae6e-9e2320d62684",
  "currency" : "USD",
  "application" : "APupypyYamsTMvnYaanN4EX7",
  "source" : "PInTQxiXCNw5m9Ru3qQ1X4di",
  "destination" : "PImmK4gYPPe7QYyqC5n9BCCo",
  "ready_to_settle_at" : null,
  "fee" : 49791,
  "statement_descriptor" : "PLD*PETES COFFEE",
  "type" : "REVERSAL",
  "messages" : [ ],
  "raw" : null,
  "created_at" : "2017-10-12T01:06:02.71Z",
  "updated_at" : "2017-10-12T01:06:02.79Z",
  "idempotency_id" : null,
  "merchant_identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
  "subtype" : "API",
  "_links" : {
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    },
    "self" : {
      "href" : "https://api-test.payline.io:443/transfers/TRrcvcSgvL6XkjsUfVLUhqh5"
    },
    "parent" : {
      "href" : "https://api-test.payline.io:443/transfers/TRuxpQA9xJefc4Re6mPZvJCC"
    },
    "destination" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PImmK4gYPPe7QYyqC5n9BCCo"
    },
    "merchant_identity" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
    },
    "payment_instruments" : {
      "href" : "https://api-test.payline.io:443/transfers/TRrcvcSgvL6XkjsUfVLUhqh5/payment_instruments"
    }
  }
}

A Transfer representing the refund (i.e. reversal) of a previously created Transfer (type DEBIT). The refunded amount may be any value up to the amount of the original Transfer. These specific Transfers are distinguished by their type which return REVERSAL.

A Reversal can have two subtypes indicating how they were created:

HTTP Request

POST https://api-test.payline.io/transfers/:TRANSFER_ID/reversals

URL Parameters

Parameter Description
:TRANSFER_ID ID of the original Transfer

Request Arguments

Field Type Description
refund_amount integer, required The amount of the refund in cents (Must be equal to or less than the amount of the original Transfer)

List all Transfers

curl https://api-test.payline.io/transfers \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98

import io.payline.payments.ApiClient;
import io.payline.payments.interfaces.ApiError;
import io.payline.payments.interfaces.Maybe;
import io.payline.payments.lib.Page;
import io.payline.payments.views.Transfer;

Maybe<Page<Transfer>> request = api.transfers.get();

if (! request.succeeded()) {
    ApiError error = request.error();
    System.out.println(error.getCode());
    System.out.println(error.getMessage());
    System.out.println(error.getDetails());
    throw new RuntimeException("API error attempting to list all Transfers");
}

Page<Transfer> page = request.view();

<?php
use Payline\Resources\Transfer;

$transfers = Transfer::getPagination("/transfers");




from payline.resources import Transfer
transfer = Transfer.get()

transfers = Payline::Transfer.retrieve

Example Response:

{
  "_embedded" : {
    "transfers" : [ {
      "id" : "TR4Bgv1VHDePfYZdpUfUv9z6",
      "amount" : 100,
      "tags" : { },
      "state" : "PENDING",
      "trace_id" : "2ff94b68-09bb-42dc-9f9e-76f4f845a874",
      "currency" : "USD",
      "application" : "APupypyYamsTMvnYaanN4EX7",
      "source" : "PImmK4gYPPe7QYyqC5n9BCCo",
      "destination" : "PInTQxiXCNw5m9Ru3qQ1X4di",
      "ready_to_settle_at" : null,
      "fee" : 10,
      "statement_descriptor" : "PLD*PETES COFFEE",
      "type" : "DEBIT",
      "messages" : [ ],
      "raw" : null,
      "created_at" : "2017-10-12T01:06:06.30Z",
      "updated_at" : "2017-10-12T01:06:06.42Z",
      "idempotency_id" : null,
      "merchant_identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
      "subtype" : "API",
      "_links" : {
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        },
        "self" : {
          "href" : "https://api-test.payline.io:443/transfers/TR4Bgv1VHDePfYZdpUfUv9z6"
        },
        "payment_instruments" : {
          "href" : "https://api-test.payline.io:443/transfers/TR4Bgv1VHDePfYZdpUfUv9z6/payment_instruments"
        },
        "merchant_identity" : {
          "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
        },
        "reversals" : {
          "href" : "https://api-test.payline.io:443/transfers/TR4Bgv1VHDePfYZdpUfUv9z6/reversals"
        },
        "fees" : {
          "href" : "https://api-test.payline.io:443/transfers/TR4Bgv1VHDePfYZdpUfUv9z6/fees"
        },
        "disputes" : {
          "href" : "https://api-test.payline.io:443/transfers/TR4Bgv1VHDePfYZdpUfUv9z6/disputes"
        },
        "source" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PImmK4gYPPe7QYyqC5n9BCCo"
        },
        "destination" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PInTQxiXCNw5m9Ru3qQ1X4di"
        }
      }
    }, {
      "id" : "TRrcvcSgvL6XkjsUfVLUhqh5",
      "amount" : 497912,
      "tags" : { },
      "state" : "SUCCEEDED",
      "trace_id" : "26931be8-eb44-42bb-91dd-31e45b11712f",
      "currency" : "USD",
      "application" : "APupypyYamsTMvnYaanN4EX7",
      "source" : "PInTQxiXCNw5m9Ru3qQ1X4di",
      "destination" : "PImmK4gYPPe7QYyqC5n9BCCo",
      "ready_to_settle_at" : null,
      "fee" : 49791,
      "statement_descriptor" : "PLD*PETES COFFEE",
      "type" : "REVERSAL",
      "messages" : [ ],
      "raw" : null,
      "created_at" : "2017-10-12T01:06:02.60Z",
      "updated_at" : "2017-10-12T01:06:02.79Z",
      "idempotency_id" : null,
      "merchant_identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
      "subtype" : "API",
      "_links" : {
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        },
        "self" : {
          "href" : "https://api-test.payline.io:443/transfers/TRrcvcSgvL6XkjsUfVLUhqh5"
        },
        "payment_instruments" : {
          "href" : "https://api-test.payline.io:443/transfers/TRrcvcSgvL6XkjsUfVLUhqh5/payment_instruments"
        },
        "merchant_identity" : {
          "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
        },
        "parent" : {
          "href" : "https://api-test.payline.io:443/transfers/TRuxpQA9xJefc4Re6mPZvJCC"
        },
        "destination" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PImmK4gYPPe7QYyqC5n9BCCo"
        }
      }
    }, {
      "id" : "TRuxpQA9xJefc4Re6mPZvJCC",
      "amount" : 497912,
      "tags" : {
        "order_number" : "21DFASJSAKAS"
      },
      "state" : "CANCELED",
      "trace_id" : "317dc4d0-3f4c-4947-af5b-15d5b6c501e8",
      "currency" : "USD",
      "application" : "APupypyYamsTMvnYaanN4EX7",
      "source" : "PImmK4gYPPe7QYyqC5n9BCCo",
      "destination" : "PInTQxiXCNw5m9Ru3qQ1X4di",
      "ready_to_settle_at" : null,
      "fee" : 49791,
      "statement_descriptor" : "PLD*PETES COFFEE",
      "type" : "DEBIT",
      "messages" : [ ],
      "raw" : null,
      "created_at" : "2017-10-12T01:06:01.43Z",
      "updated_at" : "2017-10-12T01:06:02.68Z",
      "idempotency_id" : null,
      "merchant_identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
      "subtype" : "API",
      "_links" : {
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        },
        "self" : {
          "href" : "https://api-test.payline.io:443/transfers/TRuxpQA9xJefc4Re6mPZvJCC"
        },
        "payment_instruments" : {
          "href" : "https://api-test.payline.io:443/transfers/TRuxpQA9xJefc4Re6mPZvJCC/payment_instruments"
        },
        "merchant_identity" : {
          "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
        },
        "reversals" : {
          "href" : "https://api-test.payline.io:443/transfers/TRuxpQA9xJefc4Re6mPZvJCC/reversals"
        },
        "fees" : {
          "href" : "https://api-test.payline.io:443/transfers/TRuxpQA9xJefc4Re6mPZvJCC/fees"
        },
        "disputes" : {
          "href" : "https://api-test.payline.io:443/transfers/TRuxpQA9xJefc4Re6mPZvJCC/disputes"
        },
        "source" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PImmK4gYPPe7QYyqC5n9BCCo"
        },
        "destination" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PInTQxiXCNw5m9Ru3qQ1X4di"
        }
      }
    }, {
      "id" : "TRxtX2XR8vDhRLm3i9B174kF",
      "amount" : 660898,
      "tags" : {
        "order_number" : "21DFASJSAKAS"
      },
      "state" : "SUCCEEDED",
      "trace_id" : "d81f20ae-609e-4f61-8240-02310e860d74",
      "currency" : "USD",
      "application" : "APupypyYamsTMvnYaanN4EX7",
      "source" : "PIvdndRx9wxPgtW6g5ufV1ry",
      "destination" : "PInTQxiXCNw5m9Ru3qQ1X4di",
      "ready_to_settle_at" : null,
      "fee" : 66090,
      "statement_descriptor" : "PLD*PETES COFFEE",
      "type" : "DEBIT",
      "messages" : [ ],
      "raw" : null,
      "created_at" : "2017-10-12T01:05:57.08Z",
      "updated_at" : "2017-10-12T01:06:02.16Z",
      "idempotency_id" : "9a882b2f2bf341f8aa4e7bc1d81f2b92",
      "merchant_identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
      "subtype" : "API",
      "_links" : {
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        },
        "self" : {
          "href" : "https://api-test.payline.io:443/transfers/TRxtX2XR8vDhRLm3i9B174kF"
        },
        "payment_instruments" : {
          "href" : "https://api-test.payline.io:443/transfers/TRxtX2XR8vDhRLm3i9B174kF/payment_instruments"
        },
        "merchant_identity" : {
          "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
        },
        "reversals" : {
          "href" : "https://api-test.payline.io:443/transfers/TRxtX2XR8vDhRLm3i9B174kF/reversals"
        },
        "fees" : {
          "href" : "https://api-test.payline.io:443/transfers/TRxtX2XR8vDhRLm3i9B174kF/fees"
        },
        "disputes" : {
          "href" : "https://api-test.payline.io:443/transfers/TRxtX2XR8vDhRLm3i9B174kF/disputes"
        },
        "source" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PIvdndRx9wxPgtW6g5ufV1ry"
        },
        "destination" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PInTQxiXCNw5m9Ru3qQ1X4di"
        }
      }
    }, {
      "id" : "TRop7MdiZpjR7yX2Rw9ztjK1",
      "amount" : 59981,
      "tags" : {
        "order_number" : "21DFASJSAKAS"
      },
      "state" : "SUCCEEDED",
      "trace_id" : "a6905a8b-e496-4132-a88f-1db47309278f",
      "currency" : "USD",
      "application" : "APupypyYamsTMvnYaanN4EX7",
      "source" : "PIvdndRx9wxPgtW6g5ufV1ry",
      "destination" : "PInTQxiXCNw5m9Ru3qQ1X4di",
      "ready_to_settle_at" : null,
      "fee" : 5998,
      "statement_descriptor" : "PLD*PETES COFFEE",
      "type" : "DEBIT",
      "messages" : [ ],
      "raw" : null,
      "created_at" : "2017-10-12T01:05:56.13Z",
      "updated_at" : "2017-10-12T01:06:02.36Z",
      "idempotency_id" : null,
      "merchant_identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
      "subtype" : "API",
      "_links" : {
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        },
        "self" : {
          "href" : "https://api-test.payline.io:443/transfers/TRop7MdiZpjR7yX2Rw9ztjK1"
        },
        "payment_instruments" : {
          "href" : "https://api-test.payline.io:443/transfers/TRop7MdiZpjR7yX2Rw9ztjK1/payment_instruments"
        },
        "merchant_identity" : {
          "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
        },
        "reversals" : {
          "href" : "https://api-test.payline.io:443/transfers/TRop7MdiZpjR7yX2Rw9ztjK1/reversals"
        },
        "fees" : {
          "href" : "https://api-test.payline.io:443/transfers/TRop7MdiZpjR7yX2Rw9ztjK1/fees"
        },
        "disputes" : {
          "href" : "https://api-test.payline.io:443/transfers/TRop7MdiZpjR7yX2Rw9ztjK1/disputes"
        },
        "source" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PIvdndRx9wxPgtW6g5ufV1ry"
        },
        "destination" : {
          "href" : "https://api-test.payline.io:443/payment_instruments/PInTQxiXCNw5m9Ru3qQ1X4di"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io/transfers?offset=0&limit=20&sort=created_at,desc"
    }
  },
  "page" : {
    "offset" : 0,
    "limit" : 20,
    "count" : 5
  }
}

HTTP Request

GET https://api-test.payline.io/transfers

Update a Transfer

curl https://api-test.payline.io/transfers/TRop7MdiZpjR7yX2Rw9ztjK1/ \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -X PUT \
    -d '
    {
        "tags": {
            "order_number": "12121212"
        }
    }'

import io.payline.payments.forms.*;
import io.payline.payments.views.*;
import io.payline.payments.interfaces.ApiError;
import io.payline.payments.interfaces.Maybe;
import com.google.common.collect.ImmutableMap;
import java.util.Currency;

TransferForm form = TransferForm.builder()
        .tags(ImmutableMap.of("order_number", "12121212"))
        .build();

Maybe<Transfer> response = api.transfers.post(form);

Maybe<Transfer> response = api.transfers.id("TRop7MdiZpjR7yX2Rw9ztjK1").put(form);

if (! response.succeeded()) {
    ApiError error = response.error();
    System.out.println(error.getCode());
    throw new RuntimeException("API error attempting to update transfer");
}
Transfer transfer = response.view();

<?php



from payline.resources import Transfer
transfer = Transfer.get(id="TRop7MdiZpjR7yX2Rw9ztjK1")

refund = transfer.reverse(**
                  {
                  "refund_amount" : 100
                  }
                )
refund.tags["order_number"] = "12121212"
refund.save()

transfer = Payline::Transfer.retrieve(:id=>"TRop7MdiZpjR7yX2Rw9ztjK1")

refund = transfer.reverse(100)
refund.tags = {"order_number"=> "12121212"}
refund.save

Example Response:

{
  "id" : "TRop7MdiZpjR7yX2Rw9ztjK1",
  "amount" : 59981,
  "tags" : {
    "order_number" : "12121212"
  },
  "state" : "SUCCEEDED",
  "trace_id" : "a6905a8b-e496-4132-a88f-1db47309278f",
  "currency" : "USD",
  "application" : "APupypyYamsTMvnYaanN4EX7",
  "source" : "PIvdndRx9wxPgtW6g5ufV1ry",
  "destination" : "PInTQxiXCNw5m9Ru3qQ1X4di",
  "ready_to_settle_at" : null,
  "fee" : 5998,
  "statement_descriptor" : "PLD*PETES COFFEE",
  "type" : "DEBIT",
  "messages" : [ ],
  "raw" : null,
  "created_at" : "2017-10-12T01:05:56.13Z",
  "updated_at" : "2017-10-12T01:06:33.70Z",
  "idempotency_id" : null,
  "merchant_identity" : "IDteVu9cMtNfZmeTr4pgaDeU",
  "subtype" : "API",
  "_links" : {
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    },
    "self" : {
      "href" : "https://api-test.payline.io:443/transfers/TRop7MdiZpjR7yX2Rw9ztjK1"
    },
    "payment_instruments" : {
      "href" : "https://api-test.payline.io:443/transfers/TRop7MdiZpjR7yX2Rw9ztjK1/payment_instruments"
    },
    "merchant_identity" : {
      "href" : "https://api-test.payline.io:443/identities/IDteVu9cMtNfZmeTr4pgaDeU"
    },
    "reversals" : {
      "href" : "https://api-test.payline.io:443/transfers/TRop7MdiZpjR7yX2Rw9ztjK1/reversals"
    },
    "fees" : {
      "href" : "https://api-test.payline.io:443/transfers/TRop7MdiZpjR7yX2Rw9ztjK1/fees"
    },
    "disputes" : {
      "href" : "https://api-test.payline.io:443/transfers/TRop7MdiZpjR7yX2Rw9ztjK1/disputes"
    },
    "source" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PIvdndRx9wxPgtW6g5ufV1ry"
    },
    "destination" : {
      "href" : "https://api-test.payline.io:443/payment_instruments/PInTQxiXCNw5m9Ru3qQ1X4di"
    }
  }
}

HTTP Request

PUT https://api-test.payline.io/transfers/:TRANSFER_ID

URL Parameters

Parameter Description
:TRANSFER_ID ID of the Transfer

Request Parameters

Field Type Description
tags object, required Key value pair for annotating custom meta data (e.g. order numbers)

Webhooks

Webhooks allow you to build or set up integrations which subscribe to certain automated notifications (i.e. events) on the Payline API. When one of those events is triggered, we’ll send a HTTP POST payload to the webhook’s configured URL. Instead of forcing you to pull info from the API, webhooks push notifications to your configured URL endpoint. Webhooks are particularly useful for updating asynchronous state changes in Transfers, Merchant account provisioning, and listening for notifications of newly created Disputes.

Create a Webhook


curl https://api-test.payline.io/webhooks \
    -H "Content-Type: application/vnd.json+api" \
    -u US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98 \
    -d '
                    {
                    "url" : "http://requestb.in/1jb5zu11"
                    }
                '

import io.payline.payments.ApiClient;
import io.payline.payments.forms.WebhookForm;
import io.payline.payments.interfaces.ApiError;
import io.payline.payments.interfaces.Maybe;
import io.payline.payments.views.Webhook;

WebhookForm form = WebhookForm.builder()
    .url("http://requestb.in/1jb5zu11")
    .build();

Maybe<Webhook> request = api.webhooks.post(form);

if (! request.succeeded()) {
    ApiError error = request.error();
    System.out.println(error);
    throw new RuntimeException("API error attempting to create Webhook");
}
Webhook webhookView = request.view();

<?php
use Payline\Resources\Webhook;

$webhook = new Webhook(
                    array(
                    "url" => "http=>//requestb.in/1jb5zu11"
                    )
                );
$webhook = $webhook->save();



from payline.resources import Webhook
webhook = Webhook(**
                    {
                    "url" : "http://requestb.in/1jb5zu11"
                    }
                ).save()

webhook = Payline::Webhook.new(
                    {
                    "url" => "http=>//requestb.in/1jb5zu11"
                    }
                ).save

Example Response:

{
  "id" : "WHhn2JX7sbAYswS4miErX7y8",
  "url" : "http://requestb.in/1jb5zu11",
  "enabled" : true,
  "application" : "APupypyYamsTMvnYaanN4EX7",
  "created_at" : "2017-10-12T01:05:38.26Z",
  "updated_at" : "2017-10-12T01:05:38.26Z",
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/webhooks/WHhn2JX7sbAYswS4miErX7y8"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    }
  }
}

HTTP Request

POST https://api-test.payline.io/webhooks

Request Arguments

Field Type Description
url string, required The HTTP or HTTPS url where the callbacks will be sent via POST request (max 120 characters)

Fetch a Webhook




curl https://api-test.payline.io/webhooks/WHhn2JX7sbAYswS4miErX7y8 \
    -H "Content-Type: application/vnd.json+api" \
    -u US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98


import io.payline.payments.ApiClient;
import io.payline.payments.interfaces.Maybe;
import io.payline.payments.views.Webhook;

Maybe<Webhook> response = api.webhooks
        .id("WHhn2JX7sbAYswS4miErX7y8")
        .get();

if(! response.succeeded()){
    System.out.println(response.error());
    System.out.println(response.error().getDetails());
    throw new RuntimeException("API error attempting to fetch Webhook");
}
Webhook webhookView = response.view();

<?php
use Payline\Resources\Webhook;

$webhook = Webhook::retrieve('WHhn2JX7sbAYswS4miErX7y8');





from payline.resources import Webhook
webhook = Webhook.get(id="WHhn2JX7sbAYswS4miErX7y8")

webhook = Payline::Webhook.retrieve(:id=> "WHhn2JX7sbAYswS4miErX7y8")


Example Response:

{
  "id" : "WHhn2JX7sbAYswS4miErX7y8",
  "url" : "http://requestb.in/1jb5zu11",
  "enabled" : true,
  "application" : "APupypyYamsTMvnYaanN4EX7",
  "created_at" : "2017-10-12T01:05:38.26Z",
  "updated_at" : "2017-10-12T01:05:38.26Z",
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io:443/webhooks/WHhn2JX7sbAYswS4miErX7y8"
    },
    "application" : {
      "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
    }
  }
}

HTTP Request

GET https://api-test.payline.io/webhooks/:WEBHOOK_ID

URL Parameters

Parameter Description
:WEBHOOK_ID ID of the Webhook

List all Webhooks

curl https://api-test.payline.io/webhooks/ \
    -H "Content-Type: application/vnd.json+api" \
    -u  US8YbNRmfhgnS8YkEb8cLTE2:3ec7b0e4-22ec-4a88-a1f6-e8e5f5a4bb98

import io.payline.payments.ApiClient;
import io.payline.payments.interfaces.ApiError;
import io.payline.payments.interfaces.Maybe;
import io.payline.payments.lib.Page;
import io.payline.payments.views.Webhook;

Maybe<Page<Webhook>> response = api.webhooks.get();

if (! response.succeeded()) {
    ApiError error = response.error();
    System.out.println(error.getCode());
    System.out.println(error.getMessage());
    System.out.println(error.getDetails());
    throw new RuntimeException("API error attempting to list all Webhooks");
}

Page<Webhook> page = response.view();

<?php
use Payline\Resources\Webhook;

$webhooks = Webhook::getPagination("/webhooks");




from payline.resources import Webhook
webhooks = Webhook.get()

webhooks = Payline::Webhook.retrieve

Example Response:

{
  "_embedded" : {
    "webhooks" : [ {
      "id" : "WHhn2JX7sbAYswS4miErX7y8",
      "url" : "http://requestb.in/1jb5zu11",
      "enabled" : true,
      "application" : "APupypyYamsTMvnYaanN4EX7",
      "created_at" : "2017-10-12T01:05:38.26Z",
      "updated_at" : "2017-10-12T01:05:38.26Z",
      "_links" : {
        "self" : {
          "href" : "https://api-test.payline.io:443/webhooks/WHhn2JX7sbAYswS4miErX7y8"
        },
        "application" : {
          "href" : "https://api-test.payline.io:443/applications/APupypyYamsTMvnYaanN4EX7"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "https://api-test.payline.io/webhooks?offset=0&limit=20&sort=created_at,desc"
    }
  },
  "page" : {
    "offset" : 0,
    "limit" : 20,
    "count" : 1
  }
}

HTTP Request

GET https://api-test.payline.io/webhooks

Sample Payloads

<?php


Created Authorization


{
  "type" : "created",
  "entity" : "authorization",
  "occurred_at" : "2016-07-06T08:15:21.734",
  "_embedded" : {
    "authorizations" : [ {
      "amount" : 100,
      "trace_id" : "5e157d2f-1362-4ab2-86af-3f97a8f28f0d",
      "created_at" : "2016-07-06T08:15:21.63Z",
      "source" : "PIeAkgVK9TPBnmyf6CSskv5i",
      "merchant_identity" : "IDradKrsCKMYJyj3VFKimKuy",
      "tags" : {
        "order_number" : "21DFASJSAKAS"
      },
      "transfer" : null,
      "expires_at" : "2016-07-13T08:15:21.63Z",
      "updated_at" : "2016-07-06T08:15:21.65Z",
      "is_void" : false,
      "currency" : "USD",
      "id" : "AUfU8FU7RfgTmhfRagrF1RpS",
      "state" : "SUCCEEDED"
    } ]
  }
}

Created New Transfer

{
 "type" : "created",
  "entity" : "transfer",
  "occurred_at" : "2016-07-06T07:41:38.466",
  "_embedded" : {
    "transfers" : [ {
      "amount" : 100,
      "trace_id" : "e87b8ebc-177e-4e11-9cc3-6cfcfae7adc8",
      "fee" : 0,
      "destination" : "PIg3pCsoqrygp1gCvBNvfT3x",
      "created_at" : "2016-07-06T07:41:38.24Z",
      "source" : "PI2f1E5JVeQriDMeDpULnae3",
      "merchant_identity" : "IDoXe9ce6ztf6Pbpoq2WbeMt",
      "type" : "REVERSAL",
      "tags" : { },
      "statement_descriptor" : "PLD*POLLOS HERMANOS",
      "application" : "APdHz4LE8cNmJbbK7WW2egcg",
      "updated_at" : "2016-07-06T07:41:38.37Z",
      "currency" : "USD",
      "id" : "TRjgpj7b7xZXN18XyD7G3JER",
      "state" : "PENDING"
    } ]
  }
}

Updated Transfer

{
  "type" : "updated",
  "entity" : "transfer",
  "occurred_at" : "2016-07-06T07:08:02.342",
  "_embedded"