API Reference
Authorisations API Beta
The authorisations API allows you to create new payment card authorisations and retrieve details of previous authorisations.
POST /authorisations
Creates a new authorisation and returns its details. This may be a long-running request.
Parameters
| The email address of the purchaser. | |
| description | A description of the item purchased (e.g. 500g of single origin beans). | 
| amount | The amount to authorise in the currency’s base unit (e.g. cents for AUD, yen for JPY). | 
| ip_address | The IP address of the person submitting the payment. | 
| Optional currency | The three-character ISO 4217 currency code of one of our supported currencies, e.g. AUDorUSD.
Default value isAUD. | 
| Optional reference | A custom text string which will be displayed in place of the default descriptor on the customer's bank statement. | 
| Optional metadata | Arbitrary key-value data to be associated with the authorisation. {...}A metadata item is composed of a key (a string with a maximum length of 50 characters) and a value (a string with a maximum length of 500 characters).
You can supply up to 25 metadata items per authorisation. Pin Payments does not display metadata to your customers. | 
and one of the following:
| card | The full details of the payment card to be authorised {...}.See the cards API for a description of each card parameter. | 
|---|---|
| card_token | The token of the card to be authorised, as returned from the cards API or customers API. | 
| customer_token | The token of the customer to be authorised, as returned from the customers API. | 
Example
curl https://test-api.pinpayments.com/1/authorisations -u your-secret-api-key: \
 -d "amount=400" \
 -d "currency=AUD" \
 -d "description=test authorisation" \
 -d "email=roland@pinpayments.com" \
 -d "ip_address=203.192.1.172" \
 -d "card[number]=5520000000000000" \
 -d "card[expiry_month]=05" \
 -d "card[expiry_year]=2026" \
 -d "card[cvc]=123" \
 -d "card[name]=Roland Robot" \
 -d "card[address_line1]=42 Sevenoaks St" \
 -d "card[address_line2]=" \
 -d "card[address_city]=Lathlain" \
 -d "card[address_postcode]=6454" \
 -d "card[address_state]=WA" \
 -d "card[address_country]=Australia" \
 -d "metadata[OrderNumber]=123456" \
 -d "metadata[CustomerName]=Roland Robot"
201
Created
{
  "response": {
    "token": "auth_NRzYklT8z3p0yiozsXEAIg",
    "success": true,
    "amount": 400,
    "amount_captured": 0,
    "amount_remaining": 400,
    "currency": "AUD",
    "description": "test authorisation",
    "email": "roland@pinpayments.com",
    "ip_address": "203.192.1.172",
    "created_at": "2023-06-20T03:10:49Z",
    "status_message": "Success",
    "error_message": null,
    "card": {
      "token": "card_pIQJKMs93GsCc9vLSLevbw",
      "scheme": "master",
      "display_number": "XXXX-XXXX-XXXX-0000",
      "issuing_country": "AU",
      "expiry_month": 5,
      "expiry_year": 2026,
      "name": "Roland Robot",
      "address_line1": "42 Sevenoaks St",
      "address_line2": "",
      "address_city": "Lathlain",
      "address_postcode": "6454",
      "address_state": "WA",
      "address_country": "Australia",
      "network_type": null,
      "network_format": null,
      "customer_token": null,
      "primary": null
    },
    "settlement_currency": "AUD",
    "expired": false,
    "voided": false,
    "voided_at": null,
    "capturable": true,
    "metadata": {
      "OrderNumber": "123456",
      "CustomerName": "Roland Robot"
    }
  }
}Error Responses
| 422 | invalid_resource | {...} | 
|---|---|---|
| 400 | card_declined | {...} | 
| 400 | insufficient_funds | {...} | 
| 400 | processing_error | {...} | 
| 400 | suspected_fraud | {...} | 
| 400 | expired_card | {...} | 
| 400 | lost_card | {...} | 
| 400 | stolen_card | {...} | 
| 502 | gateway_error | {...} | 
PUT /authorisations/auth-token/void
Voids a previously created authorisation and returns its details. This will return the reserved funds to the cardholder, and capture will no longer be possible.
Example
curl https://test-api.pinpayments.com/1/authorisations/auth_NRzYklT8z3p0yiozsXEAIg/void -u your-secret-api-key: -X PUT
200
OK
{
  "response": {
    "token": "auth_NRzYklT8z3p0yiozsXEAIg",
    "success": true,
    "amount": 400,
    "amount_captured": 0,
    "amount_remaining": 400,
    "currency": "AUD",
    "description": "test authorisation",
    "email": "roland@pinpayments.com",
    "ip_address": "203.192.1.172",
    "created_at": "2023-06-20T03:10:49Z",
    "status_message": "Authorisation Voided",
    "error_message": null,
    "card": {
      "token": "card_pIQJKMs93GsCc9vLSLevbw",
      "scheme": "master",
      "display_number": "XXXX-XXXX-XXXX-0000",
      "issuing_country": "AU",
      "expiry_month": 5,
      "expiry_year": 2026,
      "name": "Roland Robot",
      "address_line1": "42 Sevenoaks St",
      "address_line2": "",
      "address_city": "Lathlain",
      "address_postcode": "6454",
      "address_state": "WA",
      "address_country": "Australia",
      "network_type": null,
      "network_format": null,
      "customer_token": null,
      "primary": null
    },
    "settlement_currency": "AUD",
    "expired": false,
    "voided": true,
    "voided_at": "2023-06-20T03:11:49Z",
    "capturable": false,
    "metadata": {
      "OrderNumber": "123456",
      "CustomerName": "Roland Robot"
    }
  }
}Error Responses
| 400 | authorisation_expired | {...} | 
|---|---|---|
| 400 | already_voided | {...} | 
| 400 | already_captured | {...} | 
| 400 | bad_authorisation | {...} | 
POST /authorisations/auth-token/charges
Captures the authorised funds and returns details of the charge.
Parameters
| amount | The amount to authorise in the currency’s base unit (e.g. cents for AUD, yen for JPY). | 
|---|
Example
curl https://test-api.pinpayments.com/1/authorisations/auth_NRzYklT8z3p0yiozsXEAIg/charges -u your-secret-api-key: \
 -d "amount=250"
200
OK
{
  "response": {
    "token": "ch_IA-dSSgBc59DDWOp0Y9Xcw",
    "success": true,
    "amount": 250,
    "currency": "AUD",
    "description": "test authorisation",
    "email": "roland@pinpayments.com",
    "ip_address": "203.192.1.172",
    "created_at": "2023-06-20T03:10:49Z",
    "status_message": "Success",
    "error_message": null,
    "card": {
      "token": "card_pIQJKMs93GsCc9vLSLevbw",
      "scheme": "master",
      "display_number": "XXXX-XXXX-XXXX-0000",
      "issuing_country": "AU",
      "expiry_month": 5,
      "expiry_year": 2026,
      "name": "Roland Robot",
      "address_line1": "42 Sevenoaks St",
      "address_line2": "",
      "address_city": "Lathlain",
      "address_postcode": "6454",
      "address_state": "WA",
      "address_country": "Australia",
      "network_type": null,
      "network_format": null,
      "customer_token": null,
      "primary": null
    },
    "transfer": [],
    "amount_refunded": 0,
    "total_fees": 34,
    "merchant_entitlement": 216,
    "refund_pending": false,
    "authorisation_token": "auth_NRzYklT8z3p0yiozsXEAIg",
    "authorisation_expired": false,
    "authorisation_voided": false,
    "captured": true,
    "captured_at": "2023-06-20T03:10:49Z",
    "settlement_currency": "AUD",
    "active_chargebacks": false,
    "metadata": {
      "OrderNumber": "123456",
      "CustomerName": "Roland Robot"
    }
  }
}Error Responses
| 422 | invalid_resource | {...} | 
|---|---|---|
| 400 | authorisation_expired | {...} | 
| 400 | already_captured | {...} | 
| 400 | bad_authorisation | {...} | 
GET /authorisations
Returns a paginated list of all authorisations.
Example
curl https://test-api.pinpayments.com/1/authorisations -u your-secret-api-key:
200
OK
{
  "response": [
    {
      "token": "auth_NRzYklT8z3p0yiozsXEAIg",
      "success": true,
      "amount": 400,
      "amount_captured": 0,
      "amount_remaining": 400,
      "currency": "AUD",
      "description": "test authorisation",
      "email": "roland@pinpayments.com",
      "ip_address": "203.192.1.172",
      "created_at": "2023-06-20T03:10:49Z",
      "status_message": "Success",
      "error_message": null,
      "card": {
        "token": "card_pIQJKMs93GsCc9vLSLevbw",
        "scheme": "master",
        "display_number": "XXXX-XXXX-XXXX-0000",
        "issuing_country": "AU",
        "expiry_month": 5,
        "expiry_year": 2026,
        "name": "Roland Robot",
        "address_line1": "42 Sevenoaks St",
        "address_line2": "",
        "address_city": "Lathlain",
        "address_postcode": "6454",
        "address_state": "WA",
        "address_country": "Australia",
        "network_type": null,
        "network_format": null,
        "customer_token": null,
        "primary": null
      },
      "settlement_currency": "AUD",
      "expired": false,
      "voided": false,
      "voided_at": null,
      "capturable": true,
      "metadata": {
        "OrderNumber": "123456",
        "CustomerName": "Roland Robot"
      }
    }
  ],
  "count": 1,
  "pagination": {
    "current": 1,
    "previous": null,
    "next": null,
    "per_page": 25,
    "pages": 1,
    "count": 1
  }
}GET /authorisation/auth-token
Returns the details of a authorisation.
Example
curl https://test-api.pinpayments.com/1/authorisations/auth_NRzYklT8z3p0yiozsXEAIg -u your-secret-api-key:
200
OK
{
  "response": {
    "token": "auth_NRzYklT8z3p0yiozsXEAIg",
    "success": true,
    "amount": 400,
    "amount_captured": 0,
    "amount_remaining": 400,
    "currency": "AUD",
    "description": "test authorisation",
    "email": "roland@pinpayments.com",
    "ip_address": "203.192.1.172",
    "created_at": "2023-06-20T03:10:49Z",
    "status_message": "Success",
    "error_message": null,
    "card": {
      "token": "card_pIQJKMs93GsCc9vLSLevbw",
      "scheme": "master",
      "display_number": "XXXX-XXXX-XXXX-0000",
      "issuing_country": "AU",
      "expiry_month": 5,
      "expiry_year": 2026,
      "name": "Roland Robot",
      "address_line1": "42 Sevenoaks St",
      "address_line2": "",
      "address_city": "Lathlain",
      "address_postcode": "6454",
      "address_state": "WA",
      "address_country": "Australia",
      "network_type": null,
      "network_format": null,
      "customer_token": null,
      "primary": null
    },
    "settlement_currency": "AUD",
    "expired": false,
    "voided": false,
    "voided_at": null,
    "capturable": true,
    "metadata": {
      "OrderNumber": "123456",
      "CustomerName": "Roland Robot"
    }
  }
}Error Responses
| 404 | not_found | {...} | 
|---|
 
