API Reference

Introduction

Authentication

API requests authentication is made via HTTP Basic Auth. You have to send your API key as the HTTP password, and the user field should be left empty. We provide each merchant with the list of API permissions for their account. In the documentation, you can see the permission necessary for a specific request next to a key icon. As in:
v1.example.permission
Usage
The example below shows a request to get the list of cards for the merchant identified with an (example) API Key: mer_intg_FR2SUXtrnXgOL2KOHzcMQ9U96lJ3Wxjbr3nuvWD1UDNmyxLh.

In cURL:
curl \
--user :mer_intg_FR2SUXtrnXgOL2KOHzcMQ9U96lJ3Wxjbr3nuvWD1UDNmyxLh \
https://api.straal.com/v1/cards

Responses

The result of your request is indicated by an HTTP status code. Basically all 2xx codes indicate success, and all 4xx codes indicate failure.

HTTP status codes

200 Request was validated and performed with success / Transaction succeeded
400 Usually indicates bad/malformed request data
402 Related to payments - indicates failure
409 Indicates conflict - e.g. when you're trying to make multiple transactions on one card at the same time

Error responses

Each response with code 4xx has at least the errors field set, similar as below:
{
  "errors": [
    {"code": 10111, "message": "Invalid card number"},
    {"code": 10211, "message": "Invalid customer email"}
  ]
}
When API request fails due to payment errors, we return a response with HTTP status 402. In the errors list you will find a general error indicating payment failure, e.g.:
{
  "errors": [
    {"code": 60001, "message": "Authorization failed"}
  ]
}
For requests involving card payments you can find more details about the payment failure by checking the decline_reason field on the returned transaction object.

Below are the most common decline reasons:

1001 General decline Transaction declined by card issuer. Advise the cardholder to contact their bank and check card settings.
1002 Insufficient funds Transaction declined by card issuer - insufficient funds or limit exceeded. Please, ask the cardholder to contact their bank and check card settings.
1003 Expired card
1004 Internal error An error has occured on the side of the Straal. Please, contact Straal for more information and support.
1005 Invalid amount Transaction declined by card issuer - insufficient funds or limit exceeded. Please, ask the cardholder to contact their bank and check card settings.
1006 Invalid card data Transaction declined by card issuer - invalid card details.
1007 Restricted cardTransaction declined by card issuer. Please, ask the cardholder to contact their bank and check card settings.
1008 Invalid transaction Transaction declined by card issuer. Please, ask the cardholder to contact their bank and check card settings.
1009 Withdrawal limit exceeded Transaction declined by card issuer. Please, ask the cardholder to contact their bank and check card settings.
1010 Card not supported Transaction declined by acquirer - card type not supported.
1011 Transaction not permitted to cardholder Transaction declined by card issuer. Please, ask the cardholder to contact their bank and check card settings.
1012 Merchant account error Your merchant account is misconfigured. Please, contact Straal.
1013 Security violation Transaction declined by card issuer. Please, ask the cardholder to contact their bank and check card settings.
1014 Gateway frequency limit exceeded Acquirer activity limit exceeded. Please, contact Straal.
1015 Acquirer error An error has occured on the side of the acquiring bank. Please, contact Straal.
1016 Antifraud decline Transaction declined by Straal's antifraud system.
1017 Risk blocked in external payment system Transaction declined by Acquirer's antifraud system.
1018 Authentication 3DS failed Client not successfully authorized during 3DS process.
1019 SCA Required Additional customer authentication required.
1101 Possible fraud Transaction declined by card issuer. WARNING! The card has been designated as lost or stolen. DO NOT MAKE ANY FURTHER CHARGING ATTEMPTS - THOSE MIGHT BE CONSIDERED AS FRAUDULENT.

Expanding objects

There are various relations between resources existing within Straal API. When retrieving an object using our API, you don't always need all associated objects. For performance and better readability reasons, our API implements the expand parameter, which can be used to retrieve few or all associated objects within one request. To expand multiple objects send a list delimited by ,.

Example request for getting dummy_object
GEThttps://api.straal.com/v1/dummy_objects/g0jk87sc
{
  "id": "g0jk87sc",
  "is_dummy": true,
  "foo": {
    "id": "j5k3jdkwpmz",
    "bar": {
      "id": "j48k502kv"
    }
  }
}
Example request for getting dummy_object with expanded objects
GEThttps://api.straal.com/v1/dummy_objects/g0jk87sc?expand=foo,foo.bar
{
  "id": "g0jk87sc",
  "is_dummy": true,
  "foo": {
    "id": "j5k3jdkwpmz",
    "is_foo_attribute": true,
    "number": 100,
    "bar": {
      "id": "j48k502kv",
      "is_bar_attribute": true,
      "string": "mlk-q"
    }
  }
}

API changes

We will not make any breaking changes in the API. However, please note that adding new objects or attributes to existing objects is not considered a breaking change.

Testing resources

You can use the following test credit card numbers and IBANs in your integration environment.

3DSecure V2 Scenarios - with threeds_v2 params

4532496353677072 VISA - Card Not Enrolled - Error
4556997398420643 VISA - Network Error - Error
4929111260419572 VISA - Frictionless - Success
4556786751817853 VISA - Frictionless - Failure
4716436222435110 VISA - Challenge - Success
4539365457901717 VISA - Challenge - Failure
4637198235600777 VISA - Fallback - Success
4485735629519684 VISA - Fallback - Failure
4444444444444448 VISA - Frictionless with 3DS Method - Success
4716530227063560 VISA - Frictionless with 3DS Method - Success
4539073978065588 VISA - Frictionless with 3DS Method - Failure
4929912607956345 VISA - Challenge with 3DS Method - Success
4539876025578860 VISA - Challenge with 3DS Method - Failure
4929859585677619 VISA - Fallback with 3DS Method - Success
4539505500852488 VISA - Fallback with 3DS Method - Failure
5267621579383431 MasterCard - Card Not Enrolled - Error
5297582308509601 MasterCard - Network Error - Error
5476405082219267 MasterCard - Frictionless - Success
5526468184255647 MasterCard - Frictionless - Failure
5593877707082957 MasterCard - Challenge - Success
5515402631026288 MasterCard - Challenge - Failure
5498177754250805 MasterCard - Fallback - Success
5481087000166599 MasterCard - Fallback - Failure
5319964426348431 MasterCard - Frictionless with 3DS Method - Success
5238079599747448 MasterCard - Frictionless with 3DS Method - Failure
5113003559062879 MasterCard - Challenge with 3DS Method - Success
5327657876521164 MasterCard - Challenge with 3DS Method - Failure
5348712805985199 MasterCard - Fallback with 3DS Method - Success
5191129590856840 MasterCard - Fallback with 3DS Method - Failure

3DSecure V1 Scenarios

4532496353677072 VISA - Card Not Enrolled - Error
4556997398420643 VISA - Network Error - Error
4444444444444448 VISA - Successful 3DSecure authentication - Success
4485282121221816 VISA - Unsuccessful 3DSecure authentication - Failure
4716292201436623 VISA - 3D-Secure authentication completed, authorization failed - Failure
4485819621877561 VISA - network error 3D-Secure authentication failed to complete after redirect - Error
5267621579383431 MasterCard - Card Not Enrolled - Error
5297582308509601 MasterCard - Network Error - Error
5306605065027191 MasterCard - Successful 3DSecure authentication - Success
5437554227710785 MasterCard - Unsuccessful 3DSecure authentication - Failure
5112630232543924 MasterCard - 3D-Secure authentication completed, authorization failed - Failure
5590867286010498 MasterCard - network error 3D-Secure authentication failed to complete after redirect - Error

Scenarios without 3DSecure

4444444444444448 VISA - authorization result dependent on amount
5555444433331111 MasterCard - authorization result dependent on amount
378282246310005 American Express - authorization result dependent on amount
4462030000000000 VISA - subscriptions created with this card will be billed just once, moments after creation. Use it to test subscription notifications webhook. For the rest of test cards, subscriptions will be billed according to their plan. - Success
4929111260419572 VISA - Strong Customer Authentication card will return SCA required error - 3DS V2 is required
5476405082219267 MasterCard - Strong Customer Authentication card will return SCA required error - 3DS V2 is required

Controlling test operation results with amount

You can use specific operation amounts to cause certain results. Examples:

Test bank account

PL37109024020000000610000434 Test IBAN. In testing environments, we simulate incoming reconciliations just seconds after creating a transaction. This is helpful for your reconciliations webhook tests. In production, your transactions will have a pending status for 2 to 5 workdays.

For bank account transactions (test IBAN listed above), the following amounts will result in authorize_failed reconciliation notification: 4001, 4002, 4003. All other amounts will be processed successfully.

Changelog

2021-03-29

2020-12-17

2020-12-01

2020-11-06

2020-10-19

2020-09-14

2020-08-25

2020-06-29

2020-06-16

2020-05-05

2020-04-23

2020-04-20

2020-03-16

2020-03-11

2019-11-21

2019-11-08

2019-10-22

2019-09-16

2019-07-16

2019-07-01

2019-05-24

2019-05-22

2019-04-04

2019-02-18

2018-11-06

2018-10-10

2018-09-17

2018-09-04

2018-08-31

2018-08-22

2018-04-24

2018-04-19

2018-04-04

2018-03-27

2018-02-16

2018-02-15

2018-01-16

2018-01-12

2017-09-13

2017-07-27

Resources

Transactions

A transaction object represents a real transaction performed on a credit card or a bank account. If the transaction succeeded, the authorized attribute is set to true.

Transaction object attributes

id
string
Transaction ID
RO
attempts
list
List of previous transaction attempts that have failed
RODEPRECATED
with_3ds_params
boolean
Indicates if charge attempt was with 3DS
RO
created_at
integer
Time at which the object was created
RO
amount
integer
required
Transaction amount
currency
string
required
Transaction currency
type
string
Transaction type (only meaningful for card transactions):
  • oneshot - disables the card and forbids any future use after the first transaction (e.g. customer did not agree to have his card data saved for future use)
  • oneclick - permits future use of the card in subsequent transactions initiated by the customer (e.g. one-click checkout)
  • recurring - permits future use of the card in subsequent transactions initiated by the merchant (subscriptions or other periodic payments)
method
string
Transaction method (card, sepa, pay_by_link)
RO
authorized
boolean
Indicates if a {h.mono("v1.transactions.create")} was successfully authorized
RO
captured
boolean
Indicates if a transaction was fully captured
RO
captures
list
List of capture objects performed within a transaction
RO
refunded
boolean
Indicates if a transaction was fully refunded
RO
refunds
list
List of refund objects performed within a transaction
RO
voided
boolean
Indicates if a transaction was voided
RO
voids
list
List of void objects performed within a transaction
RO
chargeback
object
Chargeback object, if reported
RO
card
object
Card object on which transaction was performed
bank_account
object
Bank account object on which a transaction was performed
status
string
Status of a transaction, available for bank account transactions. Possible values: pending, succeeded, failed
RO
extra_data
object
Additional information about a transaction
reference
string
Your internal transaction reference (has to be unique)
MAXLEN:32UNIQUE
external_reference
string
Unique external transaction reference provided by acquirer
MAXLEN:128UNIQUERO
order_reference
string
Your internal order reference (does not have to be unique)
MAXLEN:32
decline_reason
object
Transaction decline reason, if available
capture
boolean
Indicates if the transaction should be captured. Defaults to true. If set to false, transaction will be authorized, and can be captured in separate capture request
POST ONLY
pre_auth
boolean
Indicates if the transaction should be pre-authorized. Defaults to false.
mpi_params
object
MPI data structure provided by external MPI system if the 3DS authentication has been performed.
authentication_3ds
object
a data structure which can be provided to request a transaction with 3DS. Required keys: success_url, failure_url
initiated_by
string
deprecated
This field is deprecated, use type instead.

This field is required when you create a transaction for an already existing card or bank account. Possible values are merchant and customer. A transaction is initiated by a customer when she/he takes an action to make a payment - clicks on a Pay button etc. A transaction is initiated by a merchant when it is a recurring payment made by a merchant's backend.
POST ONLY
Additional information for declined transactions is provided in the decline_reason attribute.
Sample decline_reason:
{
    "code": 1001,
    "description": "General decline"
}

Pre-authorization

To pre-authorize a transaction, set capture to false and pre_auth param to true. Pre-authorized transactions can be voided or captured.

Create a transaction

This method allows you to perform a transaction on a previously created card object.

type can take values oneclick or recurring.

POSThttps://api.straal.com/v1/cards/:card_id/transactions
v1.transactions.create
Sample request for a $9.99 transaction
{
  "amount": 999,
  "currency": "usd",
  "reference": "b138bc50148440ee",
  "type": "oneclick"
}
Sample response:
{
  "id": "f9g63mazh1wi1",
  "attempts": [],
  "with_3ds_params": false,
  "created_at": 1470238921,
  "amount": 999,
  "currency": "usd",
  "method": "card",
  "authorized": true,
  "pre_auth": false,
  "captured": true,
  "captures": [
    {
      "id": "qkymdfy2jbui1",
      "created_at": 1470239156,
      "amount": 999
    }
  ],
  "refunded": false,
  "refunds": [],
  "voided": false,
  "voids": [],
  "chargeback": null,
  "reference": "b138bc50148440ee",
  "external_reference": "44177a21403427eb96664a6d7e5d5d48",
  "order_reference": null,
  "card": {
    "id": "mzivhql5yi9rf",
    "customer": {
      "id": "mhtaqdb4edvrf"
    }
  },
  "decline_reason": null,
  "extra_data": {}
}
IMPORTANT: a customer's bank can refuse to authorize a transaction without Strong Customer Authentication. In this case we recommend requesting a transaction for previously created card with 3D Secure.

Create a transaction for existing card with 3D secure

This method allows you to perform a transaction with 3DS on a previously created card object. We recommend using this SCA-enabled flow if you need to handle customer-initiated payments (e.g. "one-click" transactions). Please contact our support to check that this method is recommended in your business case.

If the customer's card is enrolled in 3DS, this payment is asynchronous. Redirect your customer to the redirect_url returned under authentication_3ds object and wait for the request_finished notification to receive the final status of the payment.

To learn more about the 3D Secure payment process, refer to the description of a full card data payment with 3DS.

POSThttps://api.straal.com/v1/cards/:card_id/transactions
v1.transactions.create

type can only take value oneclick.

Sample request for a $9.99 transaction
{
  "amount": 999,
  "currency": "usd",
  "reference": "b138bc50148440ee",
  "type": "oneclick",
  "authentication_3ds": {
    "success_url": "http://www.example.merchant_url/success",
    "failure_url": "http://www.example.merchant_url/fail",
    "threeds_v2": {
      "browser": {
        "accept_header": "*/*",
        "color_depth": 24,
        "java_enabled": false,
        "language": "pl-PL",
        "screen_height": 1080,
        "screen_width": 1920,
        "timezone": -60,
        "user_agent": "Mozilla/4.0 (compatible; Win32; WinHttp.WinHttpRequest.5)",
        "ip": "213.120.141.140"
      }
    }
  }
}
Sample response:
{
  "id": "f9g63mazh1wi1",
  "attempts": [],
  "with_3ds_params": false,
  "created_at": 1470238921,
  "amount": 999,
  "currency": "usd",
  "method": "card",
  "authorized": true,
  "pre_auth": false,
  "captured": true,
  "captures": [
    {
      "id": "qkymdfy2jbui1",
      "created_at": 1470239156,
      "amount": 999
    }
  ],
  "refunded": false,
  "refunds": [],
  "voided": false,
  "voids": [],
  "chargeback": null,
  "reference": "b138bc50148440ee",
  "external_reference": "44177a21403427eb96664a6d7e5d5d48",
  "order_reference": null,
  "card": {
    "id": "mzivhql5yi9rf",
    "customer": {
      "id": "mhtaqdb4edvrf"
    }
  },
  "decline_reason": null,
  "extra_data": {},
  "authentication_3ds": {
    "id": "a7lr1cpt2fzqk",
    "created_at": 1606135550,
    "success_url": "http://www.example.merchant_url/success",
    "failure_url": "http://www.example.merchant_url/fail",
    "enrollment_status": "Y",
    "errors": [],
    "status": "pending",
    "protocol_version": "1.0",
    "threeds_v2": {
        "browser": {
        "accept_header": "*/*",
        "color_depth": 24,
        "java_enabled": false,
        "language": "pl-PL",
        "screen_height": 1080,
        "screen_width": 1920,
        "timezone": -60,
        "user_agent": "Mozilla/4.0 (compatible; Win32; WinHttp.WinHttpRequest.5)",
        "ip": "213.120.141.140"
        }
    },
    "redirect_url": "https://checkout.straal.com/authentications_3ds/some_token"
  }
}

Create a transaction with external MPI parameters

It's also possible to provide an optional 3D-Secure MPI data structure if the 3DS authentication has been performed by external MPI system. Optional mpi_params could be included in any of the following card transaction requests:
Create a transaction,
Create a transaction with a card,

mpi_params object for 3DS protocol version 1.
protocol_version
string
required
Protocol version, for 3DSv1 should be set to 1.0.
xid
string
required
Transaction ID generated by the 3DSv1 service that uniquely identifies the 3DSecure request.
cavv
string
required
Verification Id of the authentication. Cardholder Authentication Verification Value (CAVV) or Universal Cardholder Authentication Field (UCAF).
eci
string
required
Electronic Commerce Indicator.
mpi_params object for 3DS protocol version 2.
protocol_version
string
required
Protocol version, for 3DSv2 should be set to 2.1.0
xid
string
Transaction ID generated by the 3DSv1 service that uniquely identifies the 3DSecure request.
cavv
string
required
Verification Id of the authentication. Cardholder Authentication Verification Value (CAVV) or Universal Cardholder Authentication Field (UCAF).
eci
string
required
Electronic Commerce Indicator.
ds_transaction_id
string
required
The Directory Server ID used for 3DSecure transactions through the 3DSv2 authentication protocol.
Sample request using create a transaction endpoint
POSThttps://api.straal.com/v1/cards/:card_id/transactions
v1.transactions.create
Sample request for a transaction with 3D-Secure
{
  "amount": 999,
  "currency": "usd",
  "reference": "b138bc50148440yy",
  "type": "oneclick",
  "mpi_params": {
    "protocol_version": "1.0",
    "xid": "ODUzNTYzOTcwODU5NzY3Qw==",
    "cavv": "jJ81HADVRtXfCBATEp01CJUAAAA=",
    "eci": "05"
  }
}
Sample response
{
  "id": "p4sacj0gl5r7c",
  "card": {
    "id": "wjyjp7c87wp7c",
    "customer": {
      "id": "j9ubc9jou7c7a",
      "last_transaction": {
        "id": "p4sacj0gl5r7c"
      }
    }
  },
  "captures": [
    {
      "id": "jyjcbrrtphc75",
      "created_at": 1592302456,
      "amount": 999,
      "status": "succeeded",
      "extra_data": {}
    }
  ],
  "refunds": [],
  "voids": [],
  "attempts": [],
  "with_3ds_params": false,
  "created_at": 1592302452,
  "amount": 999,
  "currency": "usd",
  "authorized": true,
  "pre_auth": false,
  "captured": true,
  "refunded": false,
  "extra_data": {},
  "straal_custom_data": {},
  "chargeback": null,
  "reference": "b138bc50148440yy",
  "external_reference": null,
  "order_reference": null,
  "decline_reason": null,
  "voided": false,
  "method": "card"
}

Create a transaction with 3D secure

POSThttps://api.straal.com/v1/customers/:customer_id/transactions
v1.transactions.create_with_card
You can perform a 3D Secure protected transaction by providing an authentication_3ds object containing customer result URLs (success_url and failure_url) in your request payload.
This one step flow is a simpler alternative to the process described in our previous (deprecated) overview of a two step 3D secure transaction.

If the card is enrolled in 3DS program, this API request will be asynchronous: on the authentication_3ds object in the response payload you will receive a URL to redirect your customer to. The resulting transaction will not yet be authorized.

During the transaction, the customer will be redirected to a page provided by the acquirer (redirect_url) to complete 3D-Secure process. After the customer completes interaction with the page, he will be redirected back to merchant's page.

After finishing the authentication process, your customer's card will be charged and they will be redirected to the success or failure URL provided in your request.
You will receive the final transaction result in a request_finished notification on your backend (see below). To receive notifications you need to set up the notification endpoint URL for your account in the Kompas panel.

If you are not PCI certified to process payment data or you haven't submitted PCI Self-Assessment Questionnaire type "D" (for more details please refer to Straal docs > PCI Compliance), use the CryptKey flow as described here.

Sample request for a $9.99 transaction with 3DS
{
  "amount": 999,
  "currency": "usd",
  "reference": "b138bc50148440ee",
  "order_reference": null,
  "type": "oneclick",
  "capture": true,
  "card": {
    "name": "John Smith",
    "number": "4444444444444448",
    "cvv": "123",
    "expiry_month": 11,
    "expiry_year": 2023,
    "origin_ipaddr": "91.17.133.219"
  },
  "authentication_3ds": { 
    "success_url": "http://www.example.merchant_url/success",
    "failure_url": "http://www.example.merchant_url/fail",
    "threeds_v2": {
      "browser": {
        "accept_header": "*/*",
        "color_depth": 24,
        "java_enabled": false,
        "language": "pl-PL",
        "screen_height": 1080,
        "screen_width": 1920,
        "timezone": -60,
        "user_agent": "Mozilla/4.0 (compatible; Win32; WinHttp.WinHttpRequest.5)",
        "ip": "213.120.141.140"
      }
    }
  }
}
The above structure (transaction) is specified here.

You can set capture value to false in order to make a preauthorization with 3D Secure. Then you can void the transaction or do the capture.

Sample success (pending) response, the authentication_3ds object contents may be extended.
{
    "id": "fkc1arotl6kq3",
    "attempts": [],
    "with_3ds_params": false,
    "created_at": 1606135550,
    "amount": 999,
    "currency": "usd",
    "method": "card",
    "authorized": false,
    "captured": false,
    "captures": [],
    "refunded": false,
    "refunds": [],
    "voided": false,
    "voids": [],
    "chargeback": null,
    "reference": "b138bc5014844a44",
    "external_reference": "298756cf16a585af9a9e5e09fb818432",
    "order_reference": null,
    "card": {
        "id": "0mcka1vh1fkqu",
        "customer": {
            "id": "bgl1cfyz35sj2",
            "last_transaction": {
                "id": "fkc1arotl6kq3"
            }
        },
        "created_at": 1606135550,
        "brand": "visa",
        "name": "John Smith",
        "num_bin": "444444",
        "num_last_4": "4448",
        "expiry_month": 11,
        "expiry_year": 2023,
        "origin_ipaddr": "91.17.133.219",
        "extra_data": {},
        "straal_custom_data": {},
        "state": "active",
        "state_flags": []
    },
    "authentication_3ds": {
        "id": "a7lr1cpt2fzqk",
        "created_at": 1606135550,
        "success_url": "http://www.example.merchant_url/success",
        "failure_url": "http://www.example.merchant_url/fail",
        "enrollment_status": "Y",
        "errors": [],
        "status": "pending",
        "protocol_version": "1.0",
        "threeds_v2": {
          "browser": {
            "accept_header": "*/*",
            "color_depth": 24,
            "java_enabled": false,
            "language": "pl-PL",
            "screen_height": 1080,
            "screen_width": 1920,
            "timezone": -60,
            "user_agent": "Mozilla/4.0 (compatible; Win32; WinHttp.WinHttpRequest.5)",
            "ip": "213.120.141.140"
          }
        },
        "redirect_url": "https://checkout.straal.com/authentications_3ds/some_token"
    },
    "decline_reason": null,
    "extra_data": {},
    "straal_custom_data": {}
}
Sample failure response, synchronous (e.g. due to the failed 3DS initialization):
{
    "id": "fkc1arotl6kq3",
    "attempts": [],
    "with_3ds_params": false,
    "created_at": 1606135550,
    "amount": 999,
    "currency": "usd",
    "method": "card",
    "authorized": false,
    "captured": false,
    "captures": [],
    "refunded": false,
    "refunds": [],
    "voided": false,
    "voids": [],
    "chargeback": null,
    "reference": "b138bc5014844a44",
    "external_reference": "298756cf16a585af9a9e5e09fb818432",
    "order_reference": null,
    "card": {
        "id": "0mcka1vh1fkqu",
        "customer": {
            "id": "bgl1cfyz35sj2",
            "last_transaction": {
                "id": "fkc1arotl6kq3"
            }
        },
        "created_at": 1606135550,
        "brand": "visa",
        "name": "John Smith",
        "num_bin": "453249",
        "num_last_4": "7072",
        "expiry_month": 11,
        "expiry_year": 2023,
        "origin_ipaddr": "91.17.133.219",
        "extra_data": {},
        "straal_custom_data": {},
        "state": "active",
        "state_flags": []
    },
    "authentication_3ds": {
        "id": "gxb1acbkr8rqa",
        "created_at": 1606136918,
        "success_url": "http://www.example.merchant_url/success",
        "failure_url": "http://www.example.merchant_url/fail",
        "enrollment_status": "N",
        "errors": [
            {
                "code": 17015,
                "message": "3DS authentication failed"
            }
        ],
        "status": "failed",
        "protocol_version": "1.0",
        "threeds_v2": {
          "browser": {
            "accept_header": "*/*",
            "color_depth": 24,
            "java_enabled": false,
            "language": "pl-PL",
            "screen_height": 1080,
            "screen_width": 1920,
            "timezone": -60,
            "user_agent": "Mozilla/4.0 (compatible; Win32; WinHttp.WinHttpRequest.5)",
            "ip": "213.120.141.140"
          }
        }
    },
    "errors": [
        {
            "code": 60001,
            "message": "Authorization failed"
        },
        {
            "code": 17015,
            "message": "3DS authentication failed"
        }
    ],
    "decline_reason": {
        "code": 1018,
        "description": "3DS Authentication failed"
    },
    "extra_data": {},
    "straal_custom_data": {}
}

Wait for the request_finished notification on your backend. This notification will contain the final state of this payment. You don't need to finalize the transaction as you would using the (deprecated) two step 3D secure transaction.

Please note that we send the request finished notification for all transaction-related requests (which means for majority of POST requests to our API). Filter out the relevant notifications by checking the permission field.

The request_finished notification for the 3DS transaction will have permission field set to v1.transactions.create_with_card and the response object will be the final state of the transaction object that you received in the API response before redirecting the customer.
A successful 3DS transaction will be authorized and the authentication_3ds will have status "succeeded". If you requested a captured transaction, which is the default, it should also be captured.
{
  "event": "request_finished",
  "data": {
    "path": "/v1/customers/mzivhql5yi9rf/transactions",
    "permission": "v1.transactions.create_with_card",
    "auth_method": "apikey",
    "cryptkey": {},
    "request_id": "0e04ead77926441c9369f1932ddd13c8",
    "response": {
      "id": "f9g63mazh1wi1",
      "attempts": [],
      "with_3ds_params": true,
      "created_at": 1470238921,
      "amount": 999,
      "currency": "usd",
      "authorized": true,
      "pre_auth": false,
      "captured": true,
      "captures": [
        {
          "id": "qkymdfy2jbui1",
          "created_at": 1470239156,
          "amount": 999
        }
      ],
      "refunded": false,
      "refunds": [],
      "voided": false,
      "voids": [],
      "chargeback": null,
      "reference": "b138bc50148440ee",
      "external_reference": null,
      "order_reference": null,
      "card": {
        "id": "mzivhql5yi9rf",
        "customer": {
          "id": "mhtaqdb4edvrf"
        }
      },
      "authentication_3ds":  {
        "id": "688xc7ogyc5ja",
        "success_url": "http://www.example.merchant_url/success",
        "failure_url": "http://www.example.merchant_url/fail",
        "status": "succeeded",
        "created_at": 1472491822,
        "enrollment_status": "Y",
        "errors": [],
        "threeds_v2": {
          "browser": {
            "accept_header": "*/*",
            "color_depth": 24,
            "java_enabled": false,
            "language": "pl-PL",
            "screen_height": 1080,
            "screen_width": 1920,
            "timezone": -60,
            "user_agent": "Mozilla/4.0 (compatible; Win32; WinHttp.WinHttpRequest.5)",
            "ip": "213.120.141.140"
          }
        }
      },
      "decline_reason": null,
      "extra_data": {}
    }
  }
}


An example of the request_finished notification for a failed 3DS transaction (in this example, the 3DS authentication has succeeded but there were insufficient funds on the customer's account):
{
  "event": "request_finished",
  "data": {
    "path": "/v1/customers/mzivhql5yi9rf/transactions",
    "permission": "v1.transactions.create_with_card",
    "auth_method": "apikey",
    "cryptkey": {},
    "request_id": "0e04ead77926441c9369f1932ddd13c8",
    "response": {
      "id": "f9g63mazh1wi1",
      "attempts": [],
      "with_3ds_params": true,
      "created_at": 1470238921,
      "amount": 999,
      "currency": "usd",
      "authorized": false,
      "captured": false,
      "captures": [],
      "refunded": false,
      "refunds": [],
      "voided": false,
      "voids": [],
      "chargeback": null,
      "reference": "b138bc50148440ee",
      "external_reference": null,
      "order_reference": null,
      "card": {
        "id": "mzivhql5yi9rf",
        "customer": {
          "id": "mhtaqdb4edvrf"
        }
      },
      "authentication_3ds":  {
        "id": "688xc7ogyc5ja",
        "success_url": "http://www.example.merchant_url/success",
        "failure_url": "http://www.example.merchant_url/fail",
        "status": "succeeded",
        "created_at": 1472491822,
        "enrollment_status": "Y",
        "errors": [],
        "threeds_v2": {
          "browser": {
            "accept_header": "*/*",
            "color_depth": 24,
            "java_enabled": false,
            "language": "pl-PL",
            "screen_height": 1080,
            "screen_width": 1920,
            "timezone": -60,
            "user_agent": "Mozilla/4.0 (compatible; Win32; WinHttp.WinHttpRequest.5)",
            "ip": "213.120.141.140"
          }
        }
      },
      "decline_reason": {
        "code": 1002,
        "description": "Insufficient funds"
      },
      "extra_data": {}
    }
  }
}

Create a 3DS transaction with a card using CryptKey

Learn below how to perform a card transaction with 3D Secure by sending sensitive data directly from a mobile application or website frontend code, so no card data hits your servers, which results in improved security and fewer PCI compliance requirements.

By performing the steps below you will register a card and perform a $9.99 transaction on it, protected by 3D Secure protocol.

1. Create CryptKey with v1.transactions.create_with_card permission

It has to be done from your application backend, and the request has to be authorized by an APIKey with the correct permission. Transaction details have to be sent along with create CryptKey request. Similarly to server-to-server variant, you need to provide customer result URLs to your transaction data. Since this method is always executed within the customer context, you have to also include customer_id in the request payload. Sample request:
{
  "permission": "v1.transactions.create_with_card",
  "customer_id": "auIj01kcj98lfq",
  "transaction": {
    "amount": 999,
    "currency": "usd",
    "capture": true,
    "type": "oneclick",
    "reference": "b138bc50148440ee",
    "extra_data": {
      "key": "value"
    },
    "authentication_3ds": { 
      "success_url": "http://www.example.merchant_url/success",
      "failure_url": "http://www.example.merchant_url/fail",
      "threeds_v2": {
        "browser": {
          "accept_header": "*/*",
          "color_depth": 24,
          "java_enabled": false,
          "language": "pl-PL",
          "screen_height": 1080,
          "screen_width": 1920,
          "timezone": -60,
          "user_agent": "Mozilla/4.0 (compatible; Win32; WinHttp.WinHttpRequest.5)",
          "ip": "213.120.141.140"
        }
      }
    }
  }
}
The transaction data structure is specified here.

You can set capture value to false in order to make a preauthorization with 3D Secure. Then you can void the transaction or do the capture.

reference and extra_data are optional, authentication_3ds is required if you want to trigger 3DS authentication for customer.

Browser part of 3DS v2 parameters is optional in this request, but if not provided, Browser object should be included in encrypted payload as described in step 3.

2. Pass CryptKey into your frontend code

The preferred method to achieve this would be to send a request to your backend. But you could include the CryptKey value somewhere in your HTML code.

3. Encrypt the card data and send it directly to Straal API
POSThttps://api.straal.com/v1/encrypted
The easiest way to do that is to use the Straal.js library.
A request containing card data should have the following format:
{
  "name": "John Smith",
  "number": "4444444444444448",
  "cvv": "123",
  "expiry_month": 11,
  "expiry_year": 2021,
  "browser": {
    "color_depth": 24,
    "java_enabled": false,
    "language": "pl-PL",
    "screen_height": 1080,
    "screen_width": 1920,
    "timezone": -60
  }
}
Browser part of 3DS v2 parameters can be send in request body instead of adding it at the create CryptKey step. If no accept_header, ip and/or user_agent Browser params will be provided, they will be taken from appropriate headers of encrypted request.

The response body will contain a request_id field which should be matched later on with the request_finished notification.
{
  "request_id": "db7a6a7c37c949f78acb563427456ee3"
}

4. Redirect your customer to the provided URL

If the request is successful (status code 200), you will receive a Location header along with the response. Redirect your customer to this URL for him to complete the 3D-Secure verification process.

If you are using Straal.js, it will automatically redirect your customer. After the 3D-Secure verification is finished, your customer will be redirected back to one of the specified URLs (success_url or failure_url) depending on the outcome of the 3D-Secure verification.

5. Wait for the request_finished notification on your backend (>>>you need to set up the notification endpoint URL for your account in the Kompas panel). This notification will contain the final state of this payment. You don't need to finalize the transaction as you would using the (deprecated) two step 3D secure transaction. Please note that we send the request finished notification for all transaction-related requests (which means for majority of POST requests to our API). Filter out the relevant notifications by checking the permission field, which in this flow is v1.transactions.create_with_card.

The request_finished notification for the 3DS transaction will have permission field set to v1.transactions.create_with_card and the response object will be the final state of the transaction object that was created in the encrypted request from the front-end. In the data you will also find request_id of the front-end request as well as cryptkey ID that was used.
The request_finished notification for the 3DS transaction will have the following format. A successful 3DS transaction will be authorized and the authentication_3ds will have status "succeeded". If you requested a captured transaction, which is the default, it should also be captured.
{
  "event": "request_finished",
  "data": {
    "path": "/v1/customers/mzivhql5yi9rf/transactions",
    "permission": "v1.transactions.create_with_card",
    "auth_method": "cryptkey", 
    "cryptkey": {
      "id": "70xfzmynzgkih"
    },
    "request_id": "0e04ead77926441c9369f1932ddd13c8",
    "response": {
      "id": "f9g63mazh1wi1",
      "attempts": [],
      "with_3ds_params": true,
      "created_at": 1470238921,
      "amount": 999,
      "currency": "usd",
      "authorized": true,
      "pre_auth": false,
      "captured": true,
      "captures": [
        {
          "id": "qkymdfy2jbui1",
          "created_at": 1470239156,
          "amount": 999
        }
      ],
      "refunded": false,
      "refunds": [],
      "voided": false,
      "voids": [],
      "chargeback": null,
      "reference": "b138bc50148440ee",
      "external_reference": null,
      "order_reference": null,
      "card": {
        "id": "mzivhql5yi9rf",
        "customer": {
          "id": "mhtaqdb4edvrf"
        }
      },
      "authentication_3ds":  {
        "id": "8dc41dh1drlqm",
         "status": "succeeded",
         "created_at": 1606128812,
         "failure_url": "http://www.example.merchant_url/fail",
         "success_url": "http://www.example.merchant_url/success",
         "threeds_params": null,
         "protocol_version": "1.0",
         "enrollment_status": "Y",
         "errors": [],
         "threeds_v2": {
          "browser": {
            "accept_header": "*/*",
            "color_depth": 24,
            "java_enabled": false,
            "language": "pl-PL",
            "screen_height": 1080,
            "screen_width": 1920,
            "timezone": -60,
            "user_agent": "Mozilla/4.0 (compatible; Win32; WinHttp.WinHttpRequest.5)",
            "ip": "213.120.141.140"
          }
         }
      },
      "decline_reason": null,
      "extra_data": {}
    }
  }
}


An example of the request_finished notification for a failed 3DS transaction (in this example, the 3DS authentication has succeeded but there were insufficient funds on the customer's account):
{
  "event": "request_finished",
  "data": {
    "path": "/v1/customers/mzivhql5yi9rf/transactions",
    "permission": "v1.transactions.create_with_card",
    "auth_method": "cryptkey", 
    "cryptkey": {
      "id": "70xfzmynzgkih"
    },
    "request_id": "0e04ead77926441c9369f1932ddd13c8",
    "response": {
      "id": "f9g63mazh1wi1",
      "attempts": [],
      "with_3ds_params": true,
      "created_at": 1470238921,
      "amount": 999,
      "currency": "usd",
      "authorized": false,
      "captured": false,
      "captures": [],
      "refunded": false,
      "refunds": [],
      "voided": false,
      "voids": [],
      "chargeback": null,
      "reference": "b138bc50148440ee",
      "external_reference": null,
      "order_reference": null,
      "card": {
        "id": "mzivhql5yi9rf",
        "customer": {
          "id": "mhtaqdb4edvrf"
        }
      },
      "authentication_3ds":  {
        "id": "1q43cj6o3w8qv",
         "status": "succeeded",
         "created_at": 1606134039,
         "failure_url": "http://www.example.merchant_url/fail",
         "success_url": "http://www.example.merchant_url/success",
         "threeds_params": null,
         "protocol_version": "1.0",
         "enrollment_status": "Y",
         "errors": [],
         "threeds_v2": {
          "browser": {
            "accept_header": "*/*",
            "color_depth": 24,
            "java_enabled": false,
            "language": "pl-PL",
            "screen_height": 1080,
            "screen_width": 1920,
            "timezone": -60,
            "user_agent": "Mozilla/4.0 (compatible; Win32; WinHttp.WinHttpRequest.5)",
            "ip": "213.120.141.140"
          }
         }
      },
      "decline_reason": {
        "code": 1002,
        "description": "Insufficient funds"
      },
      "extra_data": {}
    }
  }
}

3DS v2 request parameters

Below is the structure of threeds_v2 object. There are many parameters, but only a little number of them is required. The more information is provided, the bigger chances of having frictionless authorisation or detecting fraudulent transaction.
acct_info
object
CardholderAccountInformation object object providing additional information about the Cardholder’s account provided by the 3DS Requestor.
browser
object
required
Browser object, representing browser parameters.
merchant_risk_ind
object
MerchantRiskIndicator object - merchant’s assessment of the level of fraud risk for the specific authentication for both the cardholder and the authentication being conducted. Note: Data will be formatted into a JSON object prior to being placed into the Device Merchant Risk Indicator field of the message.
transaction_type
string
Transaction Type - identifies the type of transaction being authenticated. Note: Values derived from the 8583 ISO Standard.
Possible values:
01 - Goods/ Service Purchase
03 - Check Acceptance
10 - Account Funding
11 - Quasi-Cash Transaction
28 - Prepaid Activation and Load
challenge_indicator
string
3DS Requestor Challenge Indicator - indicates whether a challenge is requested for this transaction.

Examples:
  • for Payment Authentication, a 3DS Requestor may have concerns about the transaction, and request a challenge.
  • for Non Payment Authentication, a challenge may be necessary when adding a new card to a wallet.
  • for local/regional mandates or other variables.
Possible values:
01 - No preference
02 - No challenge requested
03 - Challenge requested (3DS Requestor preference)
04 - Challenge requested (Mandate)
05 - No challenge requested (transactional risk analysis is already performed)
06 - No challenge requested (Data share only)
07 - No challenge requested (strong consumer authentication is already performed)
08 - No challenge requested (utilise whitelist exemption if no challenge required)
09 - Challenge requested (whitelist prompt requested if challenge required)
exemption_flag
string
Flags the transaction as exemption during authorization.
Possible values:
01 - Low value exemption
02 - TRA Exemption
03 - Trusted beneficiary exemption
04 - Corporate card payment exemption
05 - For recurring transactions
06 - For MIT
07 - For MOTO
visa_merchant_id
string
VMID assigned by Visa if participating in Trusted merchant program. Required when exemption value is trusted_merchant

CardholderAccountInformation object - additional information about the Cardholder’s account provided by the 3DS Requestor.
account_age
string
Cardholder Account Age IndicatorPossible values:
01 - No account (guest check-out)
02 - Created during this transaction
03 - Less than 30 days
04 - 30−60 days
05 - More than 60 days
last_change_date
string
Date that the cardholder’s account with the 3DS Requestor was last changed, including Billing or Shipping address, new payment account, or new user(s) added.
Length: 8 characters
Format accepted: YYYYMMDD
update_indicator
string
Cardholder Account Change Indicator
Possible values:
01 - Changed during this transaction
02 - Less than 30 days
03 - 30−60 days
04 - More than 60 days
creation_date
string
Date that the cardholder opened the account with the 3DS Requestor.
Length: 8 characters
Format accepted: YYYYMMDD
password_change_date
string
Date that cardholder’s account with the 3DS Requestor had a password change or account reset.
Length: 8 characters
Format accepted: YYYYMMDD
password_change_indicator
string
Indicates the length of time since the cardholder’s account with the 3DS Requestor had a password change or account reset.
Possible values:
01 - No change
02 - Changed during this transaction
03 - Less than 30 days
04 - 30−60 days
05 - More than 60 days
purchases_count_last_6_months
string
Number of purchases with this cardholder account during the previous six months.
Length: maximum 4 characters
provision_attempts_last_24_hours
string
Number of Add Card attempts in the last 24 hours.
Example values:
- 2
- 02
- 002
Length: maximum 3 characters
transactions_activity_last_24_hours
string
Number of transactions (successful and abandoned) for this cardholder account with the 3DS Requestor across all payment accounts in the previous 24 hours. Max 3 characters.
transactions_activity_previous_year
string
Number of transactions (successful and abandoned) for this cardholder account with the 3DS Requestor across all payment accounts in the previous year. Max 3 characters.
registration_date
string
Date that the payment account was enrolled in the cardholder’s account with the 3DS Requestor.
Length: 8 characters
Format accepted: YYYYMMDD
registration_indicator
string
Indicates the length of time that the payment account was enrolled in the cardholder’s account with the 3DS Requestor.
Possible values:
01 - No account (guest check-out)
02 - During this transaction
03 - Less than 30 days
04 - 30−60 days
05 - More than 60 days
shipping_address_date_first_used
string
Date when the shipping address used for this transaction was first used with the 3DS Requestor.
Length: 8 characters
Format accepted: YYYYMMDD
shipping_address_usage_indicator
string
Shipping Address Usage Indicator shipAddressUsageInd: Indicates when the shipping address used for this transaction was first used with the 3DS Requestor.
Possible values:
01 - This transaction
02 - Less than 30 days
03 - 30−60 days
04 - More than 60 days
shipping_address_match_indicator
string
Indicates if the Cardholder Name on the account is identical to the shipping Name used for this transaction.
Possible values:
01 - Account Name identical to shipping Name
02 - Account Name different than shipping Name
suspicious_activity_indicator
string
Indicates whether the 3DS Requestor has experienced suspicious activity (including previous fraud) on the cardholder account.
Possible values:
01 - No suspicious activity has been observed
02 - Suspicious activity has been observed

The structure of Browser object:
accept_header
string
required
Exact content of the HTTP accept headers as sent to the 3DS Requestor from the Cardholder’s browser.
Length: Variable, maximum 2048 characters
Value accepted: If the total length of the accept header sent by the browser exceeds 2048 characters, the 3DS Server truncates the excess portion
ip
string
IP address of the browser as returned by the HTTP headers to the 3DS Requestor.
Conditional: Shall include this field where regionally acceptable
Length: Variable, maximum 45 characters
Values accepted:
  • IPv4 address is represented in the dotted decimal format of 4 sets of decimal numbers separated by dots.
    The decimal number in each and every set is in the range 0 to 255.
    Example IPv4 address: 1.12.123.255
  • IPv6 address is represented as eight groups of four hexadecimal digits, each group representing 16 bits (two octets. The groups are separated by colons (:). Example IPv6 address:2011:0db8:85a3:0101:0101:8a2e:0370:7334
language
string
required
Value representing the browser language as defined in IETF BCP47.
Returned from navigator.language property.
Length: Variable, 1–8 haracters
user_agent
string
required
Exact content of the HTTP user-agent header.
Length: Variable, maximum 2048 characters
Value accepted: Note: If the total length of the User-Agent sent by the browser exceeds 2048 characters, the 3DS Server truncates the excess portion.
java_enabled
bool
Boolean that represents the ability of the cardholder browser to execute Java.Value is returned from the navigator.javaEnabled property.Conditional: Required when Browser JavaScript Enabled = true; otherwise Optional.
color_depth
int
Value representing the bit depth of the colour palette for displaying images, in bits per pixel.
Obtained from Cardholder browser using the screen.colorDepth property.
Conditional: Required when Browser JavaScript Enabled = true; otherwise Optional.
screen_height
int
Total height of the Cardholder’s screen in pixels.
Value is returned from the screen.height property.
Conditional: Required when Browser JavaScript Enabled = true; otherwise Optional.
Length: Variable, 1–6 characters; Numeri
screen_width
int
Total width of the cardholder’s screen in pixels.
Value is returned from the screen.width property.
Conditional: Required when Browser JavaScript Enabled = true; otherwise Optional.
Length: Variable, 1–6 characters; Numeric
timezone
int
Time-zone offset in minutes between UTC and the Cardholder browser local time.
Note that the offset is positive if the local time zone is behind UTC and negative if it is ahead.
Conditional: Required when Browser JavaScript Enabled = true; otherwise Optional.
Length: Variable, 1–5 characters
Value accepted: Value is returned from the getTimezoneOffset() method.
Example time zone offset values in minutes:
If UTC -5 hours:
- 300
- +300
If UTC +5 hours:
- 300

MerchantRiskIndicator object - merchant’s assessment of the level of fraud risk for the specific authentication for both the cardholder and the authentication being conducted.
delivery_email_address
string
For Electronic delivery, the email address to which the merchandise was delivered.
Length: maximum 254 characters
delivery_time_frame
string
Indicates the merchandise delivery timeframe.
Possible values:
01 - Electronic Delivery
02 - Same day shipping
03 - Overnight shipping
04 - Two - day or more shipping
gift_card_amount
string
For prepaid or gift card purchase, the purchase amount total of prepaid or gift card(s) in major units (for example, USD 123.45 is 123).
Example: gift card amount is USD 123.45
Values accepted:
- 123
- 0123
- 00123
Length: maximum 15 characters
gift_card_count
string
For prepaid or gift card purchase, total count of individual prepaid or gift cards/codes purchased.
Length: 2 characters
gift_card_curr
string
For prepaid or gift card purchase, ISO 4217 three-digit currency code of the gift card, other that Excluded ISO Currency and Country Code Values (see EMV 3-D Secure Protocol and Core Functions Specification v2.2.0 table A.5.)
Length: 3 characters; numeric
pre_order_date
string
For a pre-ordered purchase, the expected date that the merchandise will be available.
Length: 8 characters
Format accepted: YYYYMMDD
pre_order_pucharse_ind
string
Indicates whether Cardholder is placing an order for merchandise with a future availability or release date.
Possible values:
01 - Merchandise available
02 - Future availability
reorder_items_ind
string
Indicates whether the cardholder is reordering previously purchased merchandise.
Possible values:
01 - First time ordered
02 - Reordered
ship_indicator
string
Indicates shipping method chosen for the transaction. Merchants must choose the Shipping Indicator code that most accurately describes the cardholder’s specific transaction, not their general business. If one or more items are included in the sale, use the Shipping Indicator code for the physical goods, or if all digital goods, use the Shipping Indicator code that describes the most expensive item.
01 - Ship to cardholder’s billing address
02 - Ship to another verified address on file with merchant
03 - Ship to address that is different than the cardholder’s billing address
04 - “Ship to Store” / Pick-up at local store (Store address shall be populated in shipping address fields)
05 - Digital goods (includes online services, electronic gift cards and redemption codes)
06 - Travel and Event tickets, not shipped
07 - Other (for example, Gaming, digital services not shipped, emedia subscriptions, etc.)

3DS v2 flows

  1. The merchant submits a 3DSecure transaction (authentication_3ds object) to Straal API, including the 3DSecure v2 params (threeds_v2 object). If the card is not valid a response will be returned, indicating the error.

  2. Card issuer responds to Straal with one of possible 3DSecure v2 flows: Frictionless, Challenge or Fallback. All flows are covered by Straal.

    • Frictionless - no challenge or additional methods are required by the card issuer, the authentication has been done positively, and the transaction will be completed without further action.

    • Challenge - the card issuer determines that the transaction requires additional cardholder authentication. The customer is redirected by Straal to an URL provided by the acquirer. After the required interaction is complete, the customer is redirected to the failure to success urls.

    • Fallback - the card issuer enforces fallback to 3DSecure v1 protocol. After the required interaction is complete, the customer is redirected to the failure or success urls.

    • 3DSecure method - is performed by Straal for you in a background. 3DSecure Method is required to gather additional information about customer via their browser. 3D Secure Method helps to identify when transaction is a low risk and can be processed without required customer interaction (frictionless)

  3. A synchronous payment response is returned to the merchant, indicating the status of the payment. Also, an asynchronous notification to notification URL is enqueued (HTTP POST).

Create a transaction with a card

This method allows you to create a card and perform a transaction on it in one request.

type can take values oneshot, oneclick or recurring.

POSThttps://api.straal.com/v1/customers/:customer_id/transactions
v1.transactions.create_with_card
Sample request for a $9.99 transaction
{
  "amount": 999,
  "currency": "usd",
  "reference": "b138bc50148440ee",
  "type": "oneshot",
  "order_reference": null,
  "card": {
    "name": "John Smith",
    "number": "4444444444444448",
    "cvv": "123",
    "expiry_month": 11,
    "expiry_year": 2023,
    "origin_ipaddr": "91.17.133.219"
  }
}
Sample response
{
  "id": "f9g63mazh1wi1",
  "attempts": [],
  "with_3ds_params": false,
  "created_at": 1470238921,
  "amount": 999,
  "currency": "usd",
  "method": "card",
  "authorized": true,
  "pre_auth": false,
  "captured": true,
  "captures": [
    {
      "id": "qkymdfy2jbui1",
      "created_at": 1470239156,
      "amount": 999
    }
  ],
  "refunded": false,
  "refunds": [],
  "voided": false,
  "voids": [],
  "chargeback": null,
  "reference": "b138bc50148440ee",
  "external_reference": null,
  "order_reference": null,
  "card": {
    "id": "mzivhql5yi9rf",
    "created_at": 1467906605,
    "state": "active",
    "state_flags": [],
    "brand": "visa",
    "name": "John Smith",
    "num_bin": "444444",
    "num_last_4": "4448",
    "expiry_month": 11,
    "expiry_year": 2023,
    "origin_ipaddr": "91.17.133.219",
    "customer": {
      "id": "mhtaqdb4edvrf"
    },
    "extra_data": {}
  },
  "decline_reason": null,
  "extra_data": {}
}

Create a transaction with a card using CryptKey

The purpose of this method is to perform a transaction by sending sensitive data directly from a mobile application or website frontend code, so no card data will hit your servers, which results in improved security and fewer PCI compliance requirements.

By performing the steps below you will register a card and perform a $9.99 transaction on it.

1. Create CryptKey with v1.transactions.create_with_card permission

It has to be done from your application backend, and the request has to be authorized by an APIKey with the correct permission. Transaction details have to be sent along with create CryptKey request. Since this method is always executed within the customer context, you have to also include customer_id in the request payload. Sample request:
{
  "permission": "v1.transactions.create_with_card",
  "customer_id": "auIj01kcj98lfq",
  "transaction": {
    "amount": 999,
    "currency": "usd",
    "reference": "b138bc50148440ee",
    "type": "oneclick",
    "extra_data": {
      "key": "value"
    }
  }
}
reference and extra_data are optional.

2. Pass CryptKey into your frontend code

The preferred method to achieve this would be to send a request to your backend. But you could include the CryptKey value somewhere in your HTML code.

3. Encrypt the card data and send it directly to Straal API
POSThttps://api.straal.com/v1/encrypted
A request containing card data should have the following format:
{
  "name": "John Smith",
  "number": "4444444444444448",
  "cvv": "123",
  "expiry_month": 11,
  "expiry_year": 2023
}

Response body will contain only request_id which should be matched with request_finished notification.
{
  "request_id": "db7a6a7c37c949f78acb563427456ee3"
}
You can let your user know immediately if the payment succeeded by checking the HTTP response code.

Create a transaction for a bank account

This method allows you to perform a transaction on a previously created bank account object. SEPA transactions support only EUR currency.
initiated_by is a required field for that method.
POSThttps://api.straal.com/v1/bank_accounts/:bank_account_id/transactions
v1.transactions.create_for_bank_account
Sample request for a €9.99 transaction
{
  "amount": 999,
  "currency": "eur",
  "reference": "b138bc50148440ee",
  "initiated_by": "customer"
}
Sample response:
{
  "id": "f9g63mazh1wi1",
  "attempts": [],
  "with_3ds_params": false,
  "created_at": 1470238921,
  "amount": 999,
  "currency": "eur",
  "method": "sepa",
  "authorized": false,
  "captured": false,
  "captures": [],
  "refunded": false,
  "refunds": [],
  "voided": false,
  "voids": [],
  "chargeback": null,
  "reference": "b138bc50148440ee",
  "external_reference": null,
  "order_reference": null,
  "bank_account": {
    "id": "83ulegbkuvqmf",
    "customer": {
      "id": "mhtaqdb4edvrf"
    }
  },
  "status": "pending",
  "decline_reason": null,
  "extra_data": {}
}

Get a transaction

Returns details of an existing transaction.
If transaction was authorized with 3D-Secure, authentication_3ds details will be available.
GEThttps://api.straal.com/v1/transactions/:transaction_id
v1.transactions.get
Sample response:
{
  "id": "5nffaefhmlc6h",
  "attempts": [],
  "with_3ds_params": true,
  "created_at": 1472491810,
  "authentication_3ds":
    {
      "id": "688xc7ogyc5ja",
      "success_url": "https://your.website.url/success",
      "failure_url": "https://your.website.url/failure",
      "status": "succeeded",
      "created_at": 1472491822,
      "enrollment_status": "Y",
      "errors": []
    },
  "amount": 999,
  "currency": "usd",
  "method": "card",
  "authorized": true,
  "pre_auth": false,
  "captured": true,
  "captures": [
    {
      "id": "mkwsfft8hn66y",
      "created_at": 1472473029,
      "amount": 999
    }
  ],
  "refunded": false,
  "refunds": [],
  "voided": false,
  "voids": [],
  "chargeback": null,
  "reference": "b138bc50148440ee",
  "external_reference": null,
  "order_reference": null,
  "card": {
    "id": "5nffaefhmlc6h",
    "customer": {
      "id": "mhtaqdb4edvrf"
    }
  },
  "decline_reason": null,
  "extra_data": {}
}

Get a list of transactions

Returns a list of transactions for the merchant's account.
If transaction was authorized with 3D-Secure, authentication_3ds details will be available.
GEThttps://api.straal.com/v1/transactions
v1.transactions.list
Sample response (limited to 2 objects):
GET /v1/transactions?per_page=2&page=1
{
  "data": [
    {
      "id": "5nffaefhmlc6h",
      "attempts": [],
      "with_3ds_params": true,
      "created_at": 1472491810,
      "authentication_3ds":
        {
          "id": "688xc7ogyc5ja",
          "success_url": "https://your.website.url/success",
          "failure_url": "https://your.website.url/failure",
          "status": "succeeded",
          "created_at": 1472491822,
          "enrollment_status": "Y",
          "errors": []
        },
      "amount": 999,
      "currency": "usd",
      "method": "card",
      "authorized": true,
      "pre_auth": false,
      "captured": true,
      "captures": [
        {
          "id": "mkwsfft8hn66y",
          "created_at": 1472473029,
          "amount": 999
        }
      ],
      "refunded": false,
      "refunds": [],
      "voided": false,
      "voids": [],
      "chargeback": null,
      "reference": "b138bc50148440ee",
      "external_reference": null,
      "order_reference": null,
      "card": {
        "id": "5nffaefhmlc6h",
        "customer": {
          "id": "mhtaqdb4edvrf"
        }
      },
      "decline_reason": null,
      "extra_data": {}
    },
    {
      "id": "xdn0ffvrjxf6v",
      "attempts": [],
      "with_3ds_params": false,
      "created_at": 1472380727,
      "amount": 1599,
      "currency": "eur",
      "authorized": true,
      "pre_auth": false,
      "captured": false,
      "captures": [],
      "refunded": false,
      "refunds": [],
      "voided": false,
      "voids": [],
      "chargeback": null,
      "reference": null,
      "external_reference": null,
      "order_reference": "1495d2e44a11407b",
      "card": {
        "id": "fqovkf4k5bsbn",
        "customer": {
          "id": "sj7uj23shqf"
        }
      },
      "decline_reason": null,
      "extra_data": {}
    }
  ],
  "page": 1,
  "per_page": 2,
  "total_count": 2
}

Get a list of customer transactions

Returns a list of transactions for a specified customer ID.
GEThttps://api.straal.com/v1/customers/:customer_id/transactions
v1.transactions.customer_list
Sample response (limited to 2 objects):
GET /v1/customers/mhtaqdb4edvrf/transactions?per_page=2&page=1
{
  "data": [
    {
      "id": "5nffaefhmlc6h",
      "attempts": [],
      "with_3ds_params": false,
      "created_at": 1472491810,
      "amount": 999,
      "currency": "usd",
      "method": "card",
      "authorized": true,
      "pre_auth": false,
      "captured": true,
      "captures": [
        {
          "id": "mkwsfft8hn66y",
          "created_at": 1472473029,
          "amount": 999
        }
      ],
      "refunded": false,
      "refunds": [],
      "voided": false,
      "voids": [],
      "chargeback": null,
      "reference": "b138bc50148440ee",
      "external_reference": null,
      "order_reference": null,
      "card": {
        "id": "5nffaefhmlc6h"
      },
      "decline_reason": null,
      "extra_data": {}
    },
    {
      "id": "xdn0ffvrjxf6v",
      "attempts": [],
      "with_3ds_params": false,
      "created_at": 1472380727,
      "amount": 1599,
      "currency": "eur",
      "method": "card",
      "authorized": true,
      "pre_auth": false,
      "captured": false,
      "captures": [],
      "refunded": false,
      "refunds": [],
      "voided": false,
      "voids": [],
      "chargeback": null,
      "reference": "1495d2e44a11407b",
      "external_reference": null,
      "order_reference": null,
      "card": {
        "id": "fqovkf4k5bsbn"
      },
      "decline_reason": null,
      "extra_data": {}
    }
  ],
  "page": 1,
  "per_page": 2,
  "total_count": 2
}

Get transactions for a given card

Returns a list of transactions for a specified card ID.
GEThttps://api.straal.com/v1/cards/:card_id/transactions
v1.transactions.card_list
Sample response (limited to 2 objects):
GET /v1/cards/5nffaefhmlc6h/transactions?per_page=2&page=1
{
  "data": [
    {
      "id": "5nffaefhmlc6h",
      "attempts": [],
      "with_3ds_params": false,
      "created_at": 1472491810,
      "amount": 999,
      "currency": "usd",
      "method": "card",
      "authorized": true,
      "pre_auth": false,
      "captured": true,
      "captures": [
        {
          "id": "mkwsfft8hn66y",
          "created_at": 1472473029,
          "amount": 999
        }
      ],
      "refunded": false,
      "refunds": [],
      "voided": false,
      "voids": [],
      "chargeback": null,
      "reference": "b138bc50148440ee",
      "external_reference": null,
      "order_reference": null,
      "decline_reason": null,
      "extra_data": {}
    },
    {
      "id": "xdn0ffvrjxf6v",
      "attempts": [],
      "with_3ds_params": false,
      "created_at": 1472380727,
      "amount": 1599,
      "currency": "eur",
      "method": "card",
      "authorized": true,
      "pre_auth": false,
      "captured": false,
      "captures": [],
      "refunded": false,
      "refunds": [],
      "voided": false,
      "voids": [],
      "chargeback": null,
      "reference": "1495d2e44a11407b",
      "external_reference": null,
      "order_reference": null,
      "decline_reason": null,
      "extra_data": {}
    }
  ],
  "page": 1,
  "per_page": 2,
  "total_count": 2
}

Get transactions for a given bank account

Returns a list of transactions for a specified bank account.
GEThttps://api.straal.com/v1/bank_accounts/:bank_account_id/transactions
v1.transactions.bank_account_list
Sample response (limited to 2 objects):
GET /v1/bank_accounts/83ulegbkuvqmf/transactions?per_page=2&page=1
{
  "data": [
    {
      "id": "f9g63mazh1wi1",
      "attempts": [],
      "with_3ds_params": false,
      "created_at": 1470238921,
      "amount": 999,
      "currency": "eur",
      "method": "sepa",
      "authorized": false,
      "captured": false,
      "captures": [],
      "refunded": false,
      "refunds": [],
      "voided": false,
      "voids": [],
      "chargeback": null,
      "reference": "b138bc50148440ee",
      "external_reference": null,
      "order_reference": null,
      "status": "pending",
      "decline_reason": null,
      "extra_data": {}
    }
  ],
  "page": 1,
  "per_page": 2,
  "total_count": 1
}

Get transactions for a given subscription

Returns a list of transactions for a specified subscription ID.
GEThttps://api.straal.com/v1/subscriptions/:subscription_id/transactions
v1.transactions.subscription_list
Sample response (limited to 2 objects):
GET /v1/subscriptions/m5lwrskt18r4f/transactions?per_page=2&page=1
{
  "data": [
    {
      "id": "f9g63mazh1wi1",
      "attempts": [],
      "with_3ds_params": false,
      "created_at": 1470238921,
      "amount": 999,
      "currency": "usd",
      "method": "card",
      "authorized": true,
      "pre_auth": false,
      "captured": true,
      "captures": [
        {
          "id": "mkwsfft8hn66y",
          "created_at": 1472473029,
          "amount": 999
        }
      ],
      "refunded": false,
      "refunds": [],
      "voided": false,
      "voids": [],
      "chargeback": null,
      "reference": "b138bc50148440ee",
      "external_reference": null,
      "order_reference": null,
      "card": {
        "id": "5nffaefhmlc6h",
        "customer": {
          "id": "mhtaqdb4edvrf"
        }
      },
      "decline_reason": null,
      "extra_data": {}
    },
    {
      "id": "xdn0ffvrjxf6v",
      "attempts": [],
      "with_3ds_params": false,
      "created_at": 1472380727,
      "amount": 999,
      "currency": "usd",
      "method": "card",
      "authorized": true,
      "pre_auth": false,
      "captured": false,
      "captures": [],
      "refunded": false,
      "refunds": [],
      "voided": false,
      "voids": [],
      "chargeback": null,
      "reference": "1495d2e44a11407b",
      "external_reference": null,
      "order_reference": null,
      "card": {
        "id": "5nffaefhmlc6h",
        "customer": {
          "id": "mhtaqdb4edvrf"
        }
      },
      "decline_reason": null,
      "extra_data": {}
    }
  ],
  "page": 1,
  "per_page": 2,
  "total_count": 2
}

3D-Secure Authentications

These resources allow you to perform a transaction with 3D-Secure authentication.

3D-Secure authentication object attributes

Below is the structure of authentication_3ds object.
id
string
Id of the 3D-Secure authentication object
protocol_version
string
Protocol version
threeds_v2
object
3D-Secure v2 parameters (threeds_v2 object)
card
object
Card object on which transaction was performed
subscription
object
Additional information about subscription
token_3ds
object
Additional information about transaction
created_at
integer
Time at which the object was created
amount
integer
Transaction amount
currency
string
Transaction currency
reference
string
Your internal transaction reference (has to be unique)
success_url
string
URL to redirect to after successful 3D-Secure authentication (redirects to this URL do not indicate that the transaction succeeded, only that the Strong Customer Authentication (SCA) has been completed successfully)
failure_url
string
URL to redirect to after failed 3D-Secure authentication
enrollment_status
string
Enrollment status of the card
status
string
Status of 3D-Secure authentication
straal_custom_data
object
Your additional information for the 3D-Secure authentication
RO
errors
list
List of errors related to the 3D-Secure process

[DEPRECATED] 3D-Secure payment process overview

The 3DSecure payment process described below is now deprecated. Please refer to the overview of the new flow using CryptKeys or server-to-server integration (see our quick reference of PCI SAQ types to get help with choosing the best way of integration for your business).
  1. Initialize the 3D-Secure process.
  2. Customer is redirected to their issuing bank for the purpose of Strong Customer Authentication (SCA).
  3. After the customer has authenticated themselves with their issuing bank they will be redirected to one of the URLs provided in step 1.
    • Redirection to success_url does not mean the transaction was processed successfully, only that the customer has successfully authenticated with his bank.
  4. A request_finished notification will be sent to your backend, containing the details of the authentication attempt.
    • Up to this point, only the Strong Customer Authentication (SCA) step has been completed, no transaction has been made and no money has been transferred.
  5. Finalize the transaction - this will create a transaction and charge the card.

[DEPRECATED] Initialize 3D-Secure process with a CryptKey

This method allows you to initialize the 3D-Secure process using a CryptKey.

1. Create a CryptKey with v1.customers.authentications_3ds.init_3ds permission
POSThttps://api.straal.com/v1/cryptkeys
It has to be done from your application backend, and the request has to be authorized by an APIKey with the correct permission. Transaction details have to be sent along with the create CryptKey request. Since this method is always executed within the customer context, you have to also include customer_id in the request payload.

Sample request:
{
  "permission": "v1.customers.authentications_3ds.init_3ds",
  "customer_id": "auIj01kcj98lfq",
  "transaction": {
    "amount": 999,
    "currency": "EUR",
    "reference": "b138bc50148440ee",
    "success_url": "https://your.website.url/success",
    "failure_url": "https://your.website.url/failure",
    "extra_data": {
      "key": "value"
    }
  }
}
transaction.reference and transaction.extra_data are optional.

2. Pass CryptKey into your frontend code

The preferred method to achieve this would be to send a request to your backend. But you could include the CryptKey value somewhere in your HTML code.

3. Encrypt the card data and send it directly to Straal API
POSThttps://api.straal.com/v1/encrypted
The easiest way to do that is to use the Straal.js library.
A request containing card data should have the following format:
{
  "name": "John Smith",
  "number": "4444444444444448",
  "cvv": "123",
  "expiry_month": 11,
  "expiry_year": 2020
}
The response body will contain a request_id field which should be matched later on with the request_finished notification.
{
  "request_id": "db7a6a7c37c949f78acb563427456ee3"
}

4. Redirect your customer to the provided URL

If the request is successful (status code 200), you will receive a Location header along with the response. Redirect your customer to this URL for him to complete the 3D-Secure verification process.

If you are using Straal.js, it will automatically redirect your customer. After the 3D-Secure verification is finished, your customer will be redirected back to one of the specified URLs (success_url or failure_url) depending on the outcome of the 3D-Secure verification.

5. Wait for the request_finished notification

After you receive the request_finished notification you can complete the transaction.

It should have the following format:
{
  "event": "request_finished",
  "data": {
    "path": "/v1/customers/auIj01kcj98lfq/authentications_3ds",
    "permission": "v1.customers.authentications_3ds.init_3ds",
    "auth_method": "cryptkey",
    "cryptkey": {
      "id": "70xfzmynzgkih"
    },
    "request_id": "0e04ead77926441c9369f1932ddd13c8",
    "response": {
      "id": "688xc7ogyc5jz",
      "card": {
        "id": "6fcx1z5g8n5j7",
        "customer": {
          "id": "zqx9cebax67j7"
        }
      },
      "token_3ds": {
        "id": "wywcex2r6irjz",
        "transaction": null
      },
      "created_at": 1558455725,
      "amount": 999,
      "currency": "EUR",
      "reference": "b138bc50148440ee",
      "success_url": "https://your.website.url/success",
      "failure_url": "https://your.website.url/failure",
      "enrollment_status": "Y",
      "straal_custom_data": {},
      "errors": [],
      "redirect_url": "https://checkout.straal.com/authentications_3ds/some_token"
    }
  }
}
The data.response key represents the 3D-Secure authentication object.

At this point, the 3D-Secure authentication has been finished, but the transaction has not been completed yet.

Save the value from the id field. You can use it later to query the API about the status of the 3D-Secure authentication or to finalize the transaction.

Get a 3D-Secure authorization

Returns details of an existing 3D-Secure authentication.
GEThttps://api.straal.com/v1/authentications_3ds/:authentication_3ds_id
v1.authentications_3ds.get
Sample response:
{
  "id": "688xc7ogyc5jz",
  "card": {
    "id": "6fcx1z5g8n5j7",
    "customer": {
      "id": "zqx9cebax67j7",
       "last_transaction": {"id": "98mjmc70xnjrb"}
    }
  },
  "subscription": null,
  "token_3ds": {
    "id": "wywcex2r6irjz",
    "transaction": null
  },
  "created_at": 1558457180,
  "amount": 999,
  "currency": "EUR",
  "reference": "b138bc50148440ee",
  "success_url": "https://your.merchant.url/success",
  "failure_url": "https://your.merchant.url/fail",
  "enrollment_status": "Y",
  "straal_custom_data": {},
  "errors": []
}

[DEPRECATED] Finalize a 3D-Secure transaction

This method allows you to finalize a previously started 3D-Secure authentication process.
POSThttps://api.straal.com/v1/authentications_3ds/:authentication_3ds_id/finalize_transaction
v1.transactions.create_from_3ds_auth
The request body should be empty. Response body describes a Transaction object.

Sample response:
{
  "id": "zlxew7cky9yjd",
  "card": {
    "id": "xjpbcb9zy9zje",
    "customer": {
      "id": "9qcxlz1ilj0je",
      "last_transaction": {
        "id": "zlxew7cky9yjd"
      }
    },
    "created_at": 1558457393,
    "brand": "visa",
    "name": "John Smith",
    "num_bin": "444444",
    "num_last_4": "4448",
    "expiry_month": 1,
    "expiry_year": 2024,
    "origin_ipaddr": "91.17.133.219",
    "extra_data": {},
    "state": "active",
    "state_flags": []
  },
  "captures": [
    {
      "id": "ziat5x7f79cjg",
      "created_at": 1558457406,
      "amount": 999,
      "status": "succeeded",
      "extra_data": {}
    }
  ],
  "refunds": [],
  "voids": [],
  "attempts": [],
  "with_3ds_params": true,
  "created_at": 1558457405,
  "amount": 999,
  "currency": "eur",
  "authorized": true,
  "pre_auth": false,
  "captured": true,
  "refunded": false,
  "extra_data": {},
  "chargeback": null,
  "reference": null,
  "external_reference": null,
  "order_reference": null,
  "decline_reason": null,
  "voided": false,
  "method": "card"
}

Captures

The capture object represents a capture operation performed on previously authorised transaction. You can capture transactions that were successfully authorized and haven't been captured yet. Capture operation can be performed up to 48 hours after the successful authorization.

Capture object attributes

id
string
Capture ID
RO
created_at
integer
Time at which the capture object was created
RO
amount
integer
Amount to capture. If not set, full capture will be performed
status
string
Capture status. It may have one of the following values: succeeded or failed
RO
extra_data
object
Additional information about capture

Create a full capture

This method allows you to perform a capture on a previously authorised transaction. The capture method returns the transaction object that was being captured. If the capture succeeded, the captured attribute on the transaction object is set to true.
POSThttps://api.straal.com/v1/transactions/:transaction_id/capture
v1.transactions.capture
Sample request for full capture with extra_data.
{
  "extra_data": {
    "custom_field": "value"
  }
}
Sample response:
{
  "id": "f9g63mazh1wi1",
  "attempts": [],
  "with_3ds_params": false,
  "created_at": 1470238921,
  "amount": 999,
  "currency": "usd",
  "authorized": true,
  "pre_auth": false,
  "captured": true,
  "captures": [
    {
      "id": "qkymdfy2jbui1",
      "created_at": 1487694077,
      "amount": 999,
      "status": "succeeded",
      "extra_data": {
        "custom_field": "value"
      }
    }
  ],
  "refunded": false,
  "refunds": [],
  "voided": false,
  "voids": [],
  "chargeback": null,
  "reference": "b138bc50148440ee",
  "external_reference": null,
  "order_reference": null,
  "card": {
    "id": "mzivhql5yi9rf",
    "customer": {
      "id": "mhtaqdb4edvrf"
    }
  },
  "decline_reason": null,
  "extra_data": {}
}

Create a partial capture

To make a partial capture you have to use the same method as for a full capture. The request body needs to contain the amount that should be transferred from the cardholder account.
If the capture succeeded, the captured attribute on the transaction object is set to true.
POSThttps://api.straal.com/v1/transactions/:transaction_id/capture
v1.transactions.capture
Sample request for a partial capture:
{
  "amount": 499
}
Sample response:
{
  "id": "f9g63mazh1wi1",
  "attempts": [],
  "with_3ds_params": false,
  "created_at": 1470238921,
  "amount": 999,
  "currency": "usd",
  "authorized": true,
  "pre_auth": false,
  "captured": true,
  "captures": [
    {
      "id": "qkymdfy2jbui1",
      "created_at": 1487694077,
      "amount": 499,
      "status": "succeeded",
      "extra_data": {}
    }
  ],
  "refunded": false,
  "refunds": [],
  "voided": false,
  "voids": [],
  "chargeback": null,
  "reference": "b138bc50148440ee",
  "external_reference": null,
  "order_reference": null,
  "card": {
    "id": "mzivhql5yi9rf",
    "customer": {
      "id": "mhtaqdb4edvrf"
    }
  },
  "decline_reason": null,
  "extra_data": {}
}

Refunds

The refund object represents a real refund operation performed on a credit card.

Refund object attributes

id
string
Refund ID
RO
created_at
integer
Time at which the object was created
RO
amount
integer
Amount to refund. If not set, full refund will be performed
status
string
Refund status. It may have one of the following values: succeeded, pending or failed
RO
extra_data
object
Additional information about the refund. It might be useful to store e.g. information about the refund reason.

Create a full refund

This method allows you to perform a refund on a previously created transaction. The refund method returns a transaction object that was being refunded. If the full refund succeeded, the refunded attribute on the transaction object is set to true.
POSThttps://api.straal.com/v1/transactions/:transaction_id/refund
v1.transactions.refund
Sample request for full refund with extra_data.
{
  "extra_data": {
    "reason": "cancellation"
  }
}
Sample response:
{
  "id": "f9g63mazh1wi1",
  "attempts": [],
  "with_3ds_params": false,
  "created_at": 1470238921,
  "amount": 999,
  "currency": "usd",
  "authorized": true,
  "pre_auth": false,
  "captured": true,
  "captures": [
    {
      "id": "qkymdfy2jbui1"
    }
  ],
  "refunded": true,
  "refunds": [
    {
      "id": "cz8tteizwf0bv",
      "created_at": 1487694077,
      "amount": 999,
      "status": "succeeded",
      "extra_data": {
        "reason": "cancellation"
      }
    }
  ],
  "voided": false,
  "voids": [],
  "chargeback": null,
  "reference": "b138bc50148440ee",
  "external_reference": null,
  "order_reference": null,
  "card": {
    "id": "mzivhql5yi9rf",
    "customer": {
      "id": "mhtaqdb4edvrf"
    }
  },
  "decline_reason": null,
  "extra_data": {}
}
It is also possible to make a full refund without extra_data by just sending a POST request with an empty body.

Create a partial refund

To make a partial refund you have to use the same method as for a full refund. The request body needs to contain the amount that should be credited.
It is possible to perform more than one partial refund per transaction, as long as their sum does not exceed the original transaction amount. If the sum of partial refunds is equal to the amount of the transaction, the transaction attribute refunded is set to true.
POSThttps://api.straal.com/v1/transactions/:transaction_id/refund
v1.transactions.refund
Sample request for a partial refund:
{
  "amount": 499
}
Sample response:
{
  "id": "f9g63mazh1wi1",
  "attempts": [],
  "with_3ds_params": false,
  "created_at": 1470238921,
  "amount": 999,
  "currency": "usd",
  "authorized": true,
  "pre_auth": false,
  "captured": true,
  "captures": [
    {
      "id": "qkymdfy2jbui1"
    }
  ],
  "refunded": false,
  "refunds": [
    {
      "id": "cz8tteizwf0bv",
      "created_at": 1487694077,
      "amount": 499,
      "status": "succeeded",
      "extra_data": {}
    }
  ],
  "voided": false,
  "voids": [],
  "chargeback": null,
  "reference": "b138bc50148440ee",
  "external_reference": null,
  "order_reference": null,
  "card": {
    "id": "mzivhql5yi9rf",
    "customer": {
      "id": "mhtaqdb4edvrf"
    }
  },
  "decline_reason": null,
  "extra_data": {}
}

Cards

Card is an object which represents a credit card and its ID acts as a token which can be used to perform further transactions.

Card object attributes

id
string
Card object ID
RO
created_at
integer
Time at which the object was created
RO
state
string
State of card ("active"/"disabled")
RO
state_flags
list
List of reasons why the card is disabled, if any
RO
brand
string
Credit card brand
RO
name
string
required
Cardholder name on card
number
string
required
Credit card number, required on card creation
POST ONLY
num_bin
string
6 digits Card BIN number (based on posted number)
RO
num_last_4
string
Last 4 digits of card number (based on posted number)
RO
cvv
string
Card security code, used only on card creation
POST ONLY
expiry_month
int
required
Card expiration month (format: 1-12)
expiry_year
int
required
Card expiration year (in YYYY format)
origin_ipaddr
string
required conditionally
IP address from which the card was created. Required only if the request is sent from your backend
RO
customer
object
Credit card owner
EXPANDABLE
extra_data
object
Additional information about the card
verification_transaction
object
Object sent to override default verification transaction amount settings
POST ONLY
To ensure that the given credit card data is valid, we perform a verification_transaction when handling card object creation requests. By default, during card verification, we authorize and void a small amount from the given credit card. The default amount and currency are configured during the integration phase. To override default verification transaction amount settings, you have to send verification_transaction object in the create card request.

Verification transaction object attributes

amount
integer
Verification transaction amount
currency
string
Verification transaction currency
type
string
Verification transaction type. Defaults to oneclick.

Create a card

Creates a card for a specified customer ID.
POSThttps://api.straal.com/v1/customers/:customer_id/cards
v1.cards.create
Sample request:
{
  "name": "John Smith",
  "number": "4444444444444448",
  "cvv": "123",
  "expiry_month": 11,
  "expiry_year": 2023,
  "origin_ipaddr": "91.17.133.219"
}
Sample response:
{
  "id": "mzivhql5yi9rf",
  "created_at": 1467906605,
  "state": "active",
  "state_flags": [],
  "brand": "visa",
  "name": "John Smith",
  "num_bin": "444444",
  "num_last_4": "4448",
  "expiry_month": 11,
  "expiry_year": 2023,
  "origin_ipaddr": "91.17.133.219",
  "customer": {
    "id": "mbrudb30nt9rf"
  },
  "extra_data": {}
}

Create a card using CryptKey

The purpose of this method is to create a card directly from mobile application or website front end code, so no card data will hit your servers, which results in improved security and fewer PCI compliance requirements.

1. Create CryptKey with v1.cards.create permission

It has to be done from your application backend, and the request has to be authorized by an APIKey with the correct permission. Since this method is always executed within the customer context, you have to also include customer_id in the request payload. Sample request:
{
  "permission": "v1.cards.create",
  "customer_id": "auIj01kcj98lfq",
  "card": {
    "extra_data": {
      "key": "value"
    }
  }
}
extra_data parameter of card is optional and since it's the only possible attribute of card, you don't have to include the card object at all.

2. Pass CryptKey into your frontend code

The preferred method to achieve this would be to send a request to your backend. But you could include the CryptKey value somewhere in your HTML code.

3. Encrypt the card data and send it directly to Straal API
POSThttps://api.straal.com/v1/encrypted
Example request payload containing card data:
{
  "name": "John Smith",
  "number": "4444444444444448",
  "cvv": "123",
  "expiry_month": 11,
  "expiry_year": 2023
}
Response body will contain only request_id which should be matched with request_finished notification.
{
  "request_id": "db7a6a7c37c949f78acb563427456ee3"
}
You can let your user know immediately if payment succeeded by checking the HTTP response code.

Get a card

Returns information of a specified card.
GEThttps://api.straal.com/v1/cards/:card_id
v1.cards.get
Sample response:
{
  "id": "mzivhql5yi9rf",
  "state": "active",
  "state_flags": [],
  "created_at": 1467906605,
  "brand": "visa",
  "name": "John Smith",
  "num_bin": "444444",
  "num_last_4": "4448",
  "expiry_month": 11,
  "expiry_year": 2023,
  "origin_ipaddr": "91.17.133.219",
  "customer": {
    "id": "mbrudb30nt9rf"
  },
  "extra_data": {}
}

Get the card list

Returns a list of cards for the merchant's account.
GEThttps://api.straal.com/v1/cards
v1.cards.list
Sample response (limited to 3 objects):
GET /v1/cards?per_page=3&page=1
{
  "data": [
      {
        "id": "sq5g33mh9jf9f",
        "created_at": 1470090665,
        "state": "active",
        "state_flags": [],
        "brand": "visa",
        "name": "John Smith",
        "num_bin": "444444",
        "num_last_4": "4448",
        "expiry_month": 10,
        "expiry_year": 2016,
        "origin_ipaddr": "123.10.11.12",
        "customer": {
          "id": "bq75z9dhfut5k"
        },
        "extra_data": {}
      },
      {
        "id": "s9b7f7cqsmzd1",
        "created_at": 1474548758,
        "state": "active",
        "state_flags": [],
        "brand": "visa",
        "name": "Alan Moore",
        "num_bin": "424242",
        "num_last_4": "4242",
        "expiry_month": 6,
        "expiry_year": 2023,
        "origin_ipaddr": "11.99.98.97",
        "customer": {
          "id": "k9ibjzfdaoi5c"
        },
        "extra_data": {}
      },
      {
        "id": "k3n2btvbdrnsq",
        "created_at": 1474548758,
        "state": "disabled",
        "state_flags": [
            {
                "code": 1,
                "description": "Disabled by customer"
            }
        ],
        "brand": "mastercard",
        "name": "George Miller",
        "num_bin": "555555",
        "num_last_4": "4444",
        "expiry_month": 1,
        "expiry_year": 2019,
        "origin_ipaddr": "22.33.44.100",
        "customer": {
          "id": "00khkb5c0q75b"
        },
        "extra_data": {}
      }
  ],
  "page": 1,
  "per_page": 3,
  "total_count": 5
}

Get customer's cards

Returns a list of cards assigned to a specified customer ID.
GEThttps://api.straal.com/v1/customers/:customer_id/cards
v1.cards.customer_list
Sample response (limited to 3 objects):
GET /v1/customers/znhibktfny95i/cards?per_page=3&page=1
{
  "data": [
      {
        "id": "sq5g33mh9jf9f",
        "created_at": 1470090665,
        "state": "active",
        "state_flags": [],
        "brand": "visa",
        "name": "George Smith",
        "num_bin": "444444",
        "num_last_4": "4448",
        "expiry_month": 10,
        "expiry_year": 2016,
        "origin_ipaddr": "123.10.11.12",
        "extra_data": {}
      },
      {
        "id": "k3n2btvbdrnsq",
        "created_at": 1474548758,
        "state_flags": [
            {
                "code": 1,
                "description": "Disabled by customer"
            }
        ],
        "brand": "mastercard",
        "name": "George Smith",
        "num_bin": "555555",
        "num_last_4": "4444",
        "expiry_month": 1,
        "expiry_year": 2019,
        "origin_ipaddr": "22.33.44.100",
        "extra_data": {}
      }
  ],
  "page": 1,
  "per_page": 3,
  "total_count": 2
}

Mark card disabled

Marks given card state as "disabled". It will not be possible to perform transactions using this card after the state change. This request has to include an initiated_by field, for which possible values are customer and merchant.
POSThttps://api.straal.com/v1/cards/:card_id/disable
v1.cards.disable
Sample request:
{
  "initiated_by": "customer"
}
Sample response:
{
  "id": "waupcxsbl6m2g",
  "customer": {
    "id": "wf1xucw3r6928"
  },
  "created_at": 1583831680,
  "brand": "visa",
  "name": "John Smith",
  "num_bin": "444444",
  "num_last_4": "4448",
  "expiry_month": 11,
  "expiry_year": 2023,
  "origin_ipaddr": "91.17.133.219",
  "extra_data": {},
  "straal_custom_data": {},
  "state": "disabled",
  "state_flags": [
    {
      "code": 1,
      "description": "Disabled by customer"
    }
  ]
}

Bank Accounts

Bank account can be used to perform SEPA Direct Debit transactions.

Bank account object attributes

id
string
ID of the bank account object
RO
created_at
integer
Time at which the object was created
RO
name
string
required
Name of the bank account holder
iban
string
required
International Bank Account Number
bic
string
Business Identifier Code
mandate_id
string
ID of the mandate created for a bank account object
RO
origin_ipaddr
string
required conditionally
IP address from which the bank account was created. Required only if the request is sent from your backend
RO
customer
object
Owner of the bank account
EXPANDABLE

Create a bank account

Creates a bank account for a specified customer.
POSThttps://api.straal.com/v1/customers/:customer_id/bank_accounts
v1.bank_accounts.create
Sample request:
{
  "name": "John Smith",
  "iban": "DE89370400440532013000",
  "bic": "COBADEFFXXX",
  "origin_ipaddr": "91.17.133.219"
}
Sample response:
{
  "id": "83ulegbkuvqmf",
  "created_at": 1487251609,
  "name": "John Smith",
  "iban": "DE89370400440532013000",
  "bic": "COBADEFFXXX",
  "mandate_id": "a84764a157a840daabbc22136ab2b067",
  "origin_ipaddr": "91.17.133.219",
  "customer": {
    "id": "mbrudb30nt9rf"
  }
}

Get a bank account

Returns information about a bank account with a specified ID.
GEThttps://api.straal.com/v1/bank_accounts/:bank_account_id
v1.bank_accounts.get
Sample response:
{
  "id": "83ulegbkuvqmf",
  "created_at": 1487251609,
  "name": "John Smith",
  "iban": "DE89370400440532013000",
  "bic": "COBADEFFXXX",
  "mandate_id": "a84764a157a840daabbc22136ab2b067",
  "origin_ipaddr": "91.17.133.219",
  "customer": {
    "id": "mbrudb30nt9rf"
  }
}

Get the bank account list

Returns a list of bank accounts for the merchant's account.
GEThttps://api.straal.com/v1/bank_accounts
v1.bank_accounts.list
Sample response (limited to 3 objects):
GET /v1/bank_accounts?per_page=3&page=1
{
  "data": [
      {
        "id": "83ulegbkuvqmf",
        "created_at": 1487251609,
        "name": "John Smith",
        "iban": "DE89370400440532013000",
        "bic": "COBADEFFXXX",
        "mandate_id": "a84764a157a840daabbc22136ab2b067",
        "origin_ipaddr": "91.17.133.219",
        "customer": {
          "id": "mbrudb30nt9rf"
        }
      },
      {
        "id": "s9b7f7cqsmzd1",
        "created_at": 1474548758,
        "name": "Alan Moore",
        "iban": "DE09100100101234567890",
        "bic": "PBNKDEFFXXX",
        "mandate_id": "86d1def33a3c4972b72b0f3ffbeb646c",
        "origin_ipaddr": "11.99.98.97",
        "customer": {
          "id": "k9ibjzfdaoi5c"
        }
      },
      {
        "id": "k3n2btvbdrnsq",
        "created_at": 1474548758,
        "name": "George Miller",
        "iban": "DE79850503003100180568",
        "bic": "OSDDDE81",
        "mandate_id": "84905ef30e33414cbd49c5282ffc01b6",
        "origin_ipaddr": "22.33.44.100",
        "customer": {
          "id": "00khkb5c0q75b"
        }
      }
  ],
  "page": 1,
  "per_page": 3,
  "total_count": 5
}

Get a customer's bank account list

Returns a list of bank accounts for the specified customer ID.
GEThttps://api.straal.com/v1/customers/:customer_id/bank_accounts
v1.bank_accounts.customer_list
Sample response (limited to 3 objects):
GET /v1/customers/mbrudb30nt9rf/bank_accounts?per_page=3&page=1
{
  "data": [
      {
        "id": "83ulegbkuvqmf",
        "created_at": 1487251609,
        "name": "John Smith",
        "iban": "DE89370400440532013000",
        "bic": "COBADEFFXXX",
        "mandate_id": "a84764a157a840daabbc22136ab2b067",
        "origin_ipaddr": "91.17.133.219"
      },
      {
        "id": "s9b7f7cqsmzd1",
        "created_at": 1474548758,
        "name": "John Smith",
        "iban": "DE09100100101234567890",
        "bic": "PBNKDEFFXXX",
        "mandate_id": "86d1def33a3c4972b72b0f3ffbeb646c",
        "origin_ipaddr": "11.99.98.97"
      }
  ],
  "page": 1,
  "per_page": 3,
  "total_count": 2
}

Customers

Customer object represents your application/site user.

Customer objects

id
string
ID of the customer object
RO
created_at
integer
Time at which the object was created
RO
email
string
required
Customer email address
reference
string
Your internal customer reference (has to be unique)
MAXLEN:32UNIQUE
last_transaction
object
Customer last transaction
EXPANDABLE

Create a customer

POSThttps://api.straal.com/v1/customers
v1.customers.create
Sample request:
{
  "email": "[email protected]",
  "reference": "auIj01kcj98lfq"
}
Sample response:
{
  "id": "mhtaqdb4edvrf",
  "created_at": 1467716585,
  "email": "[email protected]",
  "reference": "auIj01kcj98lfq"
}

Get a customer

Returns a customer for a specified ID.
GEThttps://api.straal.com/v1/customers/:customer_id
v1.customers.get
Sample response:
{
  "id": "mhtaqdb4edvrf",
  "created_at": 1467716585,
  "email": "[email protected]",
  "reference": "auIj01kcj98lfq",
  "order_reference": null,
  "last_transaction": {
    "id": "f9g63mazh1wi1"
  }
}

Get the customer list

Returns a list of customers for the merchant's account.
GEThttps://api.straal.com/v1/customers
v1.customers.list
Sample response (limited to 2 objects):
GET /v1/customers?per_page=2&page=1
{
  "data": [
    {
      "id": "5nffaefhmlc6h",
      "created_at": 1451655351,
      "email": "[email protected]",
      "reference": "81lau82pnneb8",
      "order_reference": null,
      "last_transaction": {
        "id": "f9g63mazh1wi1"
      }
    },
    {
      "id": "xdn0ffvrjxf6v",
      "created_at": 1467716585,
      "email": "[email protected]",
      "reference": "auIj01kcj98lfq",
      "order_reference": null,
      "last_transaction": {
        "id": "f9g63mazh1wi1"
      }
    }
  ],
  "page": 1,
  "per_page": 2,
  "total_count": 3
}

Subscriptions

Subscription object allows you to automatically charge a user for a specified amount in a recurring manner. The amount depends on the plan associated with the subscription. Subscription requires a payment source, that is, a card or a bank account.

Subscription object attributes

id
string
ID of the subscription object
RO
created_at
integer
Time at which the object was created
RO
current_period_start
integer
-
RO
current_period_end
integer
-
RO
active
boolean
Indicates if subscription is active
cancelled_at
integer
Time at which the subscription was cancelled
RO
cancellation_source
object
The code and description of the cancellation reason (see the table below)
RO
plan_id
string
required
ID the of the plan object
POST ONLY
card
object
Card associated with the subscription
EXPANDABLE
bank_account
object
Bank account associated with the subscription
EXPANDABLE
plan
object
Plan associated with the subscription
EXPANDABLE
extra_data
object
Optional additional information about the subscription
straal_custom_data
object
Information relating to custom Straal integrations
RO
start_date
date
If set, the first subscription period, or trial, will be calculated starting from this future date.
Allowed data types: timestamp or ISO formatted date ("YYYY-MM-DD")

Available cancellation_source codes

1
API request
2
Antifraud rules
5
Received a fraud response for a transaction
6
Fraud reported
7
Chargeback
8
Credit card expired

Create a subscription

Creates a subscription for a specified card ID. You can use this method multiple times to create additional subscriptions for one card.
POSThttps://api.straal.com/v1/cards/:card_id/subscriptions
v1.subscriptions.create
Sample request:
{
  "plan_id": "mcn15j2hwhq4f"
}
Sample response:
{
  "id": "m5lwrskt18r4f",
  "created_at": 1468577492,
  "active": true,
  "cancelled_at": null,
  "cancellation_source": null,
  "current_period_start": 1468577492,
  "current_period_end": 1471169492,
  "card": {
    "id": "mru196faf8r4f",
    "customer": {
      "id": "mj3mg7w3w8r4f"
    }
  },
  "plan": {
    "id": "mcn15j2hwhq4f"
  },
  "extra_data": {},
  "straal_custom_data": {}
}

Create a subscription with a card for a given customer

Creates a subscription for a specified customer ID. You can use this method multiple times to create additional subscriptions for one customer using different cards. The card created in this request automatically becomes active, which in practice means that all subscription transactions will be performed using this card.
Notes:
- card object is required while sending a request to this URL
- when using this method, the credit card needs to be authorized, so Verification Authorization will be made. - created card object is added to response when an error occurs during subscription creation. You can use this object in other views.
POSThttps://api.straal.com/v1/customers/:customer_id/subscriptions
v1.subscriptions.create_for_customer
Sample request:
{
  "plan_id": "mcn15j2hwhq4f",
  "card": {
    "name": "Samwell Gordon",
    "number": "4444333322221111",
    "cvv": "789",
    "expiry_month": 7,
    "expiry_year": 2019,
    "origin_ipaddr": "54.4.125.235"
  }
}
Sample response:
{
  "id": "m5lwrskt18r4f",
  "created_at": 1468577492,
  "active": true,
  "cancelled_at": null,
  "cancellation_source": null,
  "current_period_start": 1468577492,
  "current_period_end": 1471169492,
  "card": {
    "id": "mru196faf8r4f",
    "created_at": 1468577403,
    "brand": "visa",
    "name": "Samwell Gordon",
    "num_bin": "444433",
    "num_last_4": "1111",
    "expiry_month": 7,
    "expiry_year": 2019,
    "origin_ipaddr": "54.4.125.235",
    "customer": {
      "id": "mj3mg7w3w8r4f"
    },
    "state": "active",
    "state_flags": [],
    "extra_data": {},
    "transactions": [
      {
        "amount": 100,
        "authorized": true,
        "pre_auth": false,
        "captured": false,
        "captures": [],
        "chargeback": null,
        "created_at": 1468577590,
        "currency": "usd",
        "decline_reason": null,
        "extra_data": {},
        "id": "n4lar14f3a54f",
        "attempts": [],
        "with_3ds_params": false,
        "reference": null,
        "external_reference": null,
        "order_reference": null,
        "refunded": false,
        "refunds": [],
        "voided": false,
        "voids": []
      }
    ]
  },
  "plan": {
    "id": "mcn15j2hwhq4f"
  },
  "extra_data": {},
  "straal_custom_data": {}
}
Sample error response:
{
  "errors": [
    {
      "message": "Authorization failed",
      "code": 60001
    }
  ],
  "plan": {
    "id": "cwssdg3d951dt"
  },
  "card": {
    "id": "mru196faf8r4f",
    "created_at": 1468577403,
    "brand": "visa",
    "name": "Samwell Gordon",
    "num_bin": "444433",
    "num_last_4": "1111",
    "expiry_month": 7,
    "expiry_year": 2019,
    "origin_ipaddr": "54.4.125.235",
    "customer": {
      "id": "mj3mg7w3w8r4f"
    },
    "state": "active",
    "state_flags": [],
    "extra_data": {},
    "transactions": [
      {
        "amount": 100,
        "authorized": false,
        "captured": false,
        "captures": [],
        "chargeback": null,
        "created_at": 1468577590,
        "currency": "usd",
        "decline_reason": {
          "code": 1001,
          "description": "General decline"
        },
        "extra_data": {},
        "id": "n4lar14f3a54f",
        "attempts": [],
        "with_3ds_params": false,
        "reference": null,
        "external_reference": null,
        "order_reference": null,
        "refunded": false,
        "refunds": [],
        "voided": false,
        "voids": []
      }
    ]
  },
  "extra_data": {}
}

Create a subscription for a given bank account

You can create subscriptions for existing bank accounts using this method. Only plans which have EUR as declared currency are supported with bank accounts.
POSThttps://api.straal.com/v1/bank_accounts/:bank_account_id/subscriptions
v1.subscriptions.create_for_bank_account
Sample request:
{
  "plan_id": "mcn15j2hwhq4f"
}
Sample response:
{
  "id": "bo10e8kfc8pmc",
  "created_at": 1487258578,
  "active": true,
  "cancelled_at": null,
  "cancellation_source": null,
  "current_period_start": 1487258583,
  "current_period_end": 1489850578,
  "bank_account": {
    "id": "83ulegbkuvqmf",
    "customer": {
      "id": "q12l8eww2vymk"
    }
  },
  "plan": {
    "id": "mcn15j2hwhq4f"
  },
  "extra_data": {},
  "straal_custom_data": {}
}

Get a subscription

Returns details of an existing subscription.
GEThttps://api.straal.com/v1/subscriptions/:subscription_id
v1.subscriptions.get
Sample response:
{
  "id": "m5lwrskt18r4f",
  "created_at": 1468577492,
  "active": true,
  "cancelled_at": null,
  "cancellation_source": null,
  "current_period_start": 1468577492,
  "current_period_end": 1471169492,
  "card": {
    "id": "mru196faf8r4f",
    "customer": {
      "id": "mj3mg7w3w8r4f"
    }
  },
  "plan": {
    "id": "mcn15j2hwhq4f"
  },
  "extra_data": {},
  "straal_custom_data": {}
}

Get the subscription list

Returns a list of subscriptions for the merchant's account.
GEThttps://api.straal.com/v1/subscriptions
v1.subscriptions.list
Sample response (limited to 2 objects):
GET /v1/subscriptions?per_page=2&page=1
{
  "data": [
    {
      "id": "m5lwrskt18r4f",
      "created_at": 1468577492,
      "active": true,
      "cancelled_at": null,
      "cancellation_source": null,
      "current_period_start": 1468577492,
      "current_period_end": 1471169492,
      "card": {
        "id": "mru196faf8r4f",
        "customer": {
          "id": "mj3mg7w3w8r4f"
        }
      },
      "plan": {
        "id": "mcn15j2hwhq4f"
      },
      "extra_data": {},
      "straal_custom_data": {}
    },
    {
      "id": "bo10e8kfc8pmc",
      "created_at": 1487258578,
      "active": true,
      "cancelled_at": null,
      "cancellation_source": null,
      "current_period_start": 1487258583,
      "current_period_end": 1489850578,
      "bank_account": {
        "id": "83ulegbkuvqmf",
        "customer": {
          "id": "q12l8eww2vymk"
        }
      },
      "plan": {
        "id": "mcn15j2hwhq4f"
      },
      "extra_data": {}
    }
  ],
  "page": 1,
  "per_page": 2,
  "total_count": 3
}

Get the subscription list for a given customer

Returns a list of subscriptions assigned to a specified customer ID.
GEThttps://api.straal.com/v1/customers/:customer_id/subscriptions
v1.subscriptions.customer_list
Sample response (limited to 3 objects):
GET /v1/customers/:id/subscriptions?per_page=3&page=1
{
  "data": [
    {
      "id": "439to9r0ezfwq",
      "created_at": 1497258894,
      "active": true,
      "cancelled_at": null,
      "cancellation_source": null,
      "current_period_start": 1497950093,
      "current_period_end": 1500542093,
      "card": {"id": "ehgl79c6xm431"},
      "plan": {
        "id": "v0fbvbm6m3fii"
      },
      "extra_data": {},
      "straal_custom_data": {}
    }
  ],
  "page": 1,
  "per_page": 3,
  "total_count": 1
}

Get the subscription list for a given card

Returns a list of subscriptions assigned to a specified card ID.
GEThttps://api.straal.com/v1/cards/:card_id/subscriptions
v1.subscriptions.card_list
Sample response (limited to 3 objects):
GET /v1/cards/:id/subscriptions?per_page=3&page=1
{
  "data": [
    {
      "id": "r3jo8a6rga9t7",
      "created_at": 1497258894,
      "active": true,
      "cancelled_at": null,
      "cancellation_source": null,
      "current_period_start": 1497950093,
      "current_period_end": 1500542093,
      "plan": {
        "id": "amnbrf6htplmt"
      },
      "extra_data": {},
      "straal_custom_data": {}
    }
  ],
  "page": 1,
  "per_page": 3,
  "total_count": 1
}

Cancel a subscription

Cancels an existing subscription. Use with caution: you cannot reinstate a cancelled subscription. You will have to create a new one instead.
POSThttps://api.straal.com/v1/subscriptions/:subscription_id/cancel
v1.subscriptions.cancel
Sample response:
{
  "id": "m5lwrskt18r4f",
  "created_at": 1468577492,
  "active": false,
  "cancelled_at": 1488214269,
  "cancellation_source": {
    "code": 1,
    "description": "API request"
  },
  "current_period_start": 1468577492,
  "current_period_end": 1471169492,
  "card": {
    "id": "mru196faf8r4f",
    "customer": {
      "id": "mj3mg7w3w8r4f"
    }
  },
  "plan": {
    "id": "mcn15j2hwhq4f"
  },
  "extra_data": {},
  "straal_custom_data": {}
}

Plans

Plan defines how often and what amount will be taken off the customer's account during subscription lifetime.

Plan object attributes

id
string
Plan object ID
RO
created_at
integer
Time at which the object was created
RO
name
string
Optional plan name
MAXLEN:128
amount
integer
required
Defines amount of recurring transactions
currency
string
required
Defines currency of recurring transactions
trial_days
integer
Trial period
step_type
string
required
Either "day", "month"` or "year"
step_value
integer
required
How many of step_type make a billing period

Create a plan

POSThttps://api.straal.com/v1/plans
v1.plans.create
Sample request for creating $19.99 monthly plan with a 7-day trial period.
{
  "name": "Regular monthly $19.99",
  "amount": 1999,
  "currency": "usd",
  "trial_days": 7,
  "step_type": "month",
  "step_value": 1
}
Response:
{
  "id": "mj501ot7vxwsf",
  "created_at": 1470068395,
  "name": "Regular monthly $19.99",
  "amount": 1999,
  "currency": "usd",
  "trial_days": 7,
  "step_type": "month",
  "step_value": 1
}

Get a plan

Returns details of an existing plan.
GEThttps://api.straal.com/v1/plans/:id
v1.plans.get
Sample response:
{
  "id": "mj501ot7vxwsf",
  "created_at": 1470068395,
  "name": "Regular monthly $19.99",
  "amount": 1999,
  "currency": "usd",
  "trial_days": 7,
  "step_type": "month",
  "step_value": 1
}

Get the list of plans

Returns a list of plans for the merchant's account.
GEThttps://api.straal.com/v1/plans
v1.plans.list
Sample response (limited to 2 objects):
GET /v1/plans?per_page=2&page=1
{
  "data": [
    {
      "id": "mj501ot7vxwsf",
      "created_at": 1470068395,
      "name": "Regular monthly $19.99",
      "amount": 1999,
      "currency": "usd",
      "trial_days": 7,
      "step_type": "month",
      "step_value": 1
    },
    {
      "id": "8o38exhmhtabr",
      "created_at": 1487591767,
      "name": "Premium monthly $59.99",
      "amount": 5999,
      "currency": "usd",
      "trial_days": 7,
      "step_type": "month",
      "step_value": 1
    }
  ],
  "page": 1,
  "per_page": 2,
  "total_count": 3
}

Checkout Page

Checkout Page is a commonly used and popular choice for accepting payments online. This method will minimize the amount of work that has to be done to integrate with Straal.

To initialize a new payment via the Checkout Page you have to initialize checkout page and redirect the user to the received checkout_url.

Straal will send notification to your backend about payment status - request_finished after a card transaction and pay_by_link_payment_succeeded or pay_by_link_payment_failed after pay-by-link payment.

In every notification, there is a checkout object nested inside the transaction object. You can match it to the checkout ID you received on checkout creation.

Checkout object attributes

id
string
Checkout object ID
RO
created_at
integer
Time at which the object was created
RO
currency
string
required
Transaction currency
amount
integer
required
Transaction amount
ttl
integer
required
Checkout expiration time (in seconds)
MINVAL:60MAXVAL:1200
return_url
string
required
User will be redirected to this URL after successful payment
failure_url
string
required
User will be redirected to this URL after failed payment
order_description
string
Description of an order - this information will be visible on the checkout page form
order_reference
string
Reference of an related order - this information will be visible on the checkout page form
checkout_url
string
URL of the checkout page, you should redirect your user to this address
RO
lang
string
If provided, user will be initially shown the checkout page in this language (supported values: cs, de, dk, en, es, fi, fr, hr, hu, it, lt, lv, nl, no, pl, pt, ro, ru, se).
POST ONLY
attempts
list
List of user attempts
RO
card_transaction
object
Parameters specific to card transactions, ignored if other payment method is selected by customer. Parameter "type" defaults to oneclick and can take value oneclick or oneshot.
POST ONLY
extra_data
object
Additional information about the checkout

Card transaction object attributes

type
string
Card transaction type. Can take values oneclick or oneshot. Defaults to oneclick.

Initialize checkout

POSThttps://api.straal.com/v1/customers/:customer_id/checkouts
v1.checkouts.create
Sample request:
{
  "currency": "usd",
  "amount": 1999,
  "ttl": 600,
  "return_url": "https://yourproduct.com/payment_succeed.html",
  "failure_url": "https://yourproduct.com/payment_failed.html",
  "lang": "en",
  "order_description": "Star Wars mug XXL",
  "order_reference": "26906303414c4f2782c653e0501c13b1",
  "card_transaction": {
    "type": "oneclick"
  },
  "extra_data": {
     "some": "additional_data"
  }
}
Sample response:
{
  "id": "a9szcp9u9e8n3",
  "created_at": 1519841724,
  "amount": 1999,
  "currency": "usd",
  "ttl": 600,
  "attempts": [],
  "checkout_url": "https://checkout.straal.com/en/9ad38808ebbc7be00e74b86bc28542",
  "return_url": "https://yourproduct.com/payment_succeed.html",
  "failure_url": "https://yourproduct.com/payment_failed.html",
  "order_description": "Star Wars mug XXL",
  "order_reference": "26906303414c4f2782c653e0501c13b1",
  "extra_data": {
     "some": "additional_data"
  }
}

Get checkout object

GEThttps://api.straal.com/v1/checkouts/:checkout_id
v1.checkouts.get
Sample response:
{
  "id": "a9szcp9u9e8n3",
  "created_at": 1519841724,
  "amount": 1999,
  "currency": "usd",
  "ttl": 600,
  "attempts": [],
  "checkout_url": "https://checkout.straal.com/9ad38808ebbc7be00e74b86bc28542",
  "return_url": "https://yourproduct.com/payment_succeed.html",
  "failure_url": "https://yourproduct.com/payment_failed.html",
  "order_description": "Star Wars mug XXL",
  "order_reference": "26906303414c4f2782c653e0501c13b1",
  "customer": {
    "id": "qv9dpoblsbunc"
  },
  "attempts": [
    {
      "id": "ygydpuy77bsnv",
      "created_at": 1519841764,
      "status": "succeeded",
      "transaction": {
        "id": "u25mpvzysb9nm",
        "attempts": [],
        "with_3ds_params": false,
        "created_at": 1519841765,
        "reference": null,
        "external_reference": null,
        "order_reference": "26906303414c4f2782c653e0501c13b1",
        "amount": 1999,
        "currency": "usd",
        "method": "card",
        "decline_reason": null,
        "authorized": true,
        "pre_auth": false,
        "captured": true,
        "captures": [
          {
            "id": "52jcsp07sbpnu",
            "created_at": 1519841768,
            "amount": 1999
          }
        ],
        "card": {
          "id": "ydpjpudy6bsn5",
          "created_at": 1519841765,
          "state": "active",
          "state_flags": [],
          "name": "Harry Potter",
          "num_bin": "444444",
          "num_last_4": "4448",
          "expiry_month": 10,
          "expiry_year": 2021,
          "brand": "visa",
          "origin_ipaddr": "94.113.114.115",
          "extra_data": {}
        },
        "refunded": false,
        "refunds": [],
        "voided": false,
        "voids": [],
        "chargeback": null,
        "extra_data": {}
      }
    }
  ]
}

CryptKeys

CryptKey is a special object that allows you to send encrypted data directly to our API endpoint without needing to authorize using API Key. This can be useful in various scenarios, such as making a request from mobile or web applications where you can't expose the API Key. CryptKey can be used to make only a single request and can be generated only with one permission which reflects specific API requests. Because the data is not sent through your back end, you have to keep in mind fewer PCI-compliance requirements.

CryptKey object attributes

id
string
Card object ID
RO
created_at
integer
Time at which the object was created
RO
key
string
Key used to encrypt the data.
RO
ttl
integer
Key expiration time (in seconds)
RO
permission
string
required
Valid request permission string

Create a CryptKey

A request for creating CryptKey has to be authorized by an API Key. It means that you have to make it from your application backend.
POSThttps://api.straal.com/v1/cryptkeys
v1.cryptkeys.create
Sample request:
{
  "permission": "v1.cards.create",
  "customer_id": "mzivhql5yi9rf"
}
Sample response (key attribute is shortened):
{
  "id": "70xfzmynzgkih",
  "created_at": 1470302857,
  "key": "06c5fbc1a9800003ba(...)",
  "permission": "v1.cards.create",
  "ttl": 600
}

Usage

Every request encrypted with CryptKey should be sent to special endpoint:
POSThttps://api.straal.com/v1/encrypted
Read more detailed usage examples:
- Create a transaction with a card using CryptKey
- Create a card using CryptKey
- Initialize a 3D-Secure authentication process using CryptKey

CSRs (Create Subscription Requests)

Create Subscription Request object stores data related to subscription creation: card or bank account, transactions, plan and, if the request succeeded, also subscription. We create CSR objects automatically for correctly formed POST requests to subscription endpoints.

CSR object attributes

id
string
CSR ID
RO
created_at
integer
Time at which the object was created
RO
card
object
Card object to charge subscription fees
RO
bank_account
object
Bank account object to charge subscription fees
RO
errors
list
List of errors related to this CSR
RO
antifraud_response
object
Information from the antifraud system
RO
transactions
list
List of transaction objects related to this CSR
RO
subscription
object
Subscription object created by this CSR
RO

Get a CSR

Returns details of a CSR.
GEThttps://api.straal.com/v1/csrs/:csr_id
v1.csrs.get
Sample response:
{
  "antifraud_response": {
    "advice": "accept"
  },
  "bank_account": null,
  "card": {
    "customer": {
        "id": "ear228iqwtkaa"
    },
    "id": "khaete0qbtwav"
  },
  "created_at": 1492785759,
  "errors": [],
  "id": "a1w9e3nqstkaw",
  "plan": {
    "id": "an7der6qztkaw"
  },
  "subscription": {
    "id": "kllcsanqwteat",
    "plan": {
      "id": "an7der6qztkaw"
    }
  },
  "transactions": [
    {
      "captures": [
        {
          "id": "wlciak9q5tear"
        }
      ],
      "id": "kzfmtaoqwteak",
      "attempts": [],
      "with_3ds_params": false,
      "refunds": [
        {
          "id": "ltqat1ecykkaw"
        }
      ],
      "voids": []
    }
  ]
}

Get the CSR list

Returns the list of CSRs for the merchant's account.
GEThttps://api.straal.com/v1/csrs
v1.csrs.list
Sample response (limited to 2 objects):
GET /v1/csrs?per_page=2&page=1
{
  "data": [
    {
      "antifraud_response": {
        "advice": "accept"
      },
      "bank_account": null,
      "card": {
        "customer": {
            "id": "ear228iqwtkaa"
        },
        "id": "khaete0qbtwav"
      },
      "created_at": 1492785759,
      "errors": [],
      "id": "a1w9e3nqstkaw",
      "plan": {
        "id": "an7der6qztkaw"
      },
      "subscription": {
        "id": "kllcsanqwteat",
        "plan": {
          "id": "an7der6qztkaw"
        }
      },
      "transactions": [
        {
          "captures": [
            {
              "id": "wlciak9q5tear"
            }
          ],
          "id": "kzfmtaoqwteak",
          "attempts": [],
          "with_3ds_params": false,
          "refunds": [
            {
              "id": "ltqat1ecykkaw"
            }
          ],
          "voids": []
        }
      ]
    },
    {
      "antifraud_response": {
        "advice": "refuse"
      },
      "bank_account": null,
      "card": {
        "customer": {
            "id": "qfdafg43sdfgh"
        },
        "id": "bvzxadfjk34df"
      },
      "created_at": 1492784444,
      "errors": [
        {"code": 70001, "message": "Dropped by antifraud"}
      ],
      "id": "a345fghjsvsa",
      "plan": {
        "id": "vcxea35tsdfa"
      },
      "subscription": null,
      "transactions": []
    }
  ],
  "page": 1,
  "per_page": 2,
  "total_count": 2
}
A pay-by-link payment object represents a pay-by-link payment attempt made by a customer.

Pay-by-link payment object attributes

id
string
Pay-by-link payment ID
RO
created_at
integer
Time at which the object was created
RO
redirect_url
string
URL to which the end user has to be redirected to make a payment
RO
payment_method_ident
string
Ident of the payment method selected by the end user
amount
integer
Transaction amount
currency
string
Transaction currency
return_url
string
URL to which the end user will be redirected after successful payment
failure_url
string
URL to which the end user will be redirected after failed payment. If not provided, the end user will be redirected to `return_url` in both cases.
origin_ipaddr
string
IP address from which the pay-by-link payment was created
description
string
Description of the payment
reference
string
Merchant payment reference
external_reference
string
Payment reference that can be shown to the end user. This reference will be used in the notification email sent to the end user, etc.
RO
status
string
Current status of the payment. Possible values: pending, succeeded, failed
RO
customer
object
Customer for whom the payment is created
ROEXPANDABLE
This method allows you to initialize a pay-by-link payment for a previously created customer object.
POSThttps://api.straal.com/v1/customers/{customer_id}/pay_by_link_payments
v1.pay_by_link_payments.create
Sample request initializing pay-by-link payment.
{
  "currency": "pln",
  "amount": 1499,
  "return_url": "https://yourproduct.com/payment_succeeded",
  "failure_url": "https://yourproduct.com/payment_failed",
  "description": "Order 123123",
  "reference": "qwerty1234qwerty",
  "order_reference": null,
  "origin_ipaddr": "123.123.123.123",
  "payment_method_ident": "bank1"
 }
Sample response:
{
  "id": "fjdan27fk72na",
  "created_at": 1472491810,
  "redirect_url": "https://bank1.example.com",
  "currency": "pln",
  "amount": 1499,
  "return_url": "https://yourproduct.com/payment_succeeded",
  "failure_url": "https://yourproduct.com/payment_failed",
  "description": "Order 123123",
  "reference": "qwerty1234qwerty",
  "order_reference": null,
  "origin_ipaddr": "123.123.123.123",
  "payment_method_ident": "bank1",
  "external_reference": "ABC123123ABC",
  "status": "pending"
}

Payment methods

Payment method is an object that represents methods that can be used to make a pay-by-link payment.

Payment method object attributes

ident
string
ID of the payment method
RO
type
string
Type of the payment method. Possible values: card and bank_transfer.
RO
description
string
Human-readable name of the payment method
RO
supported_currencies
array of strings
Array of ISO 4217 currency codes which are supported for the payment method
RO
image_url
string
URL of the image (bank logo etc.) that can be shown to the end user in the payment method selection view
RO
status
string
Status of the payment method. enabled means that you can use that method to make transactions. temporary_disabled means that it is not available at the moment but should be available soon.
RO
meta
object
An object containing additional info related to the payment method. For card payment it might be a list of supported_card_brands, for bank_transfer payment methods it will be empty.
RO

Get the list of payment methods

Returns a list of available payment methods. Using information obtained from that endpoint you can render payment method selection view to the end user.
GEThttps://api.straal.com/v1/payment_methods
v1.payment_methods.list
Sample response:
[
  {
    "description": "Pay with Straal",
    "ident": "card",
    "image_url": "https://static.straal.com/straal_logo_pbl.png",
    "meta": {},
    "status": "enabled",
    "supported_currencies": ["USD", "BRL", "EUR", "PLN"],
    "type": "card"
  },
  {
    "description": "Success",
    "ident": "integration_success",
    "image_url": "https://static.straal.com/integration_success.png",
    "meta": {},
    "status": "enabled",
    "supported_currencies": ["PLN"],
    "type": "bank_transfer"
  },
  {
    "description": "Failure",
    "ident": "integration_failure",
    "image_url": "https://static.straal.com/integration_failure.png",
    "meta": {},
    "status": "enabled",
    "supported_currencies": ["PLN"],
    "type": "bank_transfer"
  },
  {
    "description": "Temporarily disabled",
    "ident": "integration_temporarily_disabled",
    "image_url": "https://static.straal.com/integration_temporarily_disabled.png",
    "meta": {},
    "status": "temporary_disabled",
    "supported_currencies": ["PLN"],
    "type": "bank_transfer"
  }
]
It is possible to change or limit payment methods list using these GET parameters:
currency
string
Currency code in ISO 4217 format. After using this filter the results will show only payment methods that support given currency.
type
string
Payment methods type (card or bank_transfer). Only payment methods with given type will be returned.
language
string
2-letter ISO language code. Supported languages: en, pl.

Voids

The void object represents a void operation performed on a previously authorised transaction. You can void transactions that were successfully authorized and haven't been voided yet.

Void object attributes

id
string
Void ID
RO
created_at
integer
Time at which the object was created
RO
status
string
Void status. It may have one of the following values: succeeded or failed
RO
extra_data
object
Additional information about void

Create a void

This method allows you to perform a void on a previously authorised transaction. The void method returns the transaction object for which the void has been attempted. If the void succeeded, the voided attribute on the transaction object is set to true.
POSThttps://api.straal.com/v1/transactions/:transaction_id/void
v1.transactions.void
Sample request for void with extra_data.
{
  "extra_data": {
    "custom_field": "value"
  }
}
Sample response:
{
  "id": "r33crz06i0gf5",
  "attempts": [],
  "with_3ds_params": false,
  "created_at": 1539177769,
  "amount": 1000,
  "currency": "usd",
  "authorized": true,
  "pre_auth": false,
  "captured": false,
  "captures": [],
  "refunded": false,
  "refunds": [],
  "voided": true,
  "voids": [
    {
      "id": "54cr3kendrgfd",
      "created_at": 1539177769,
      "status": "succeeded",
      "extra_data": {}
    }
  ],
  "chargeback": null,
  "reference": "b138bc50148440ee",
  "external_reference": null,
  "order_reference": null,
  "card": {
    "id": "mzivhql5yi9rf",
    "customer": {
      "id": "mhtaqdb4edvrf"
    }
  },
  "decline_reason": null,
  "extra_data": {}
}

Credits [BETA]

Credits (also known as OCTs, short for Original Credit Transfers) enable you to perform transfers from your merchant account to a previously debited customer's card.
This method is useful for paying out winnings, salaries and other scenarios where you need to transfer money to your users.
Credit object represents a credit transaction performed using our API. To perform a credit you will need to reference a previous successful (captured) transaction.

Credit object attributes

id
string
Credit object ID
RO
created_at
integer
Time at which the object was created
RO
currency
string
Credit currency (same as original transaction currency)
RO
amount
integer
required
Credit amount
reference
string
required
Unique credit reference sent to acquirer, should be alphanumeric
MAXLEN:32UNIQUE
description
string
Description of a credit
status
string
Credit status. It may have one of the following values: succeeded, pending or failed
RO
errors
list
List of errors related to this credit
RO
original_transaction
Transaction referenced in credit order, contains nested IDs of card and customer
RO
extra_data
object
Additional information about the credit

Issue a credit

This method allows you to perform a credit referencing a previously performed card transaction.

The transaction referenced by the credit operation must be a card transaction (and not e.g. SEPA), and must have been successfully authorized.
POSThttps://api.straal.com/v1/transactions/:transaction_id/credits
v1.credits.create
Sample request for a 9.99 credit
{
  "amount": 999,
  "reference": "b138bc50148440ee",
  "description": "Winnings from 2021-05"
}
Sample response:
{
  "id": "jw4cl5030rwrh",
  "original_transaction": {
    "id": "csj6ply30hwrj",
    "card": {
      "id": "jpe5jc130h6rw",
      "customer": {
        "id": "ca9ae1u30hwrj",
        "last_transaction": {
          "id": "csj6ply30hwrj"
        }
      }
    }
  },
  "created_at": 1593417828,
  "amount": 999,
  "currency": "eur",
  "description": "Winnings from 2021-05",
  "reference": "b138bc50148440ee",
  "extra_data": {},
  "status": "succeeded",
  "errors": []
}

Get details about specific credit

GEThttps://api.straal.com/v1/credits/:credit_id
v1.credits.get
Sample response:
  {
    "id": "xkjh2wc02asr9",
    "original_transaction": {
      "id": "98mjmc70xnjra",
      "card": {
        "id": "9cj2ct706abrx",
        "customer": {
          "id": "94caj820naxrm",
          "last_transaction": {
            "id": "98mjmc70xnjra"
          }
        }
      }
    },
    "created_at": 1593424054,
    "amount": 999,
    "currency": "eur",
    "description": "Winnings from 2021-05",
    "reference": "b138bc50148440ee",
    "extra_data": {},
    "status": "succeeded",
    "errors": []
  }

Get a list of credits

Returns a list of credits for the merchant's account.
GEThttps://api.straal.com/v1/credits
v1.credits.list
Sample response (limited to 2 objects):
GET /v1/credits?per_page=2&page=1
{
  "data": [
  {
    "id": "xkjh2wc02asr9",
    "original_transaction": {
      "id": "98mjmc70xnjra",
      "card": {
        "id": "9cj2ct706abrx",
        "customer": {
          "id": "94caj820naxrm",
          "last_transaction": {
            "id": "98mjmc70xnjra"
          }
        }
      }
    },
    "created_at": 1593424054,
    "amount": 999,
    "currency": "eur",
    "description": "Winnings from 2021-05",
    "reference": "b138bc50148440ee",
    "extra_data": {},
    "status": "succeeded",
    "errors": []
  },
  {
    "id": "xscp9jvm8adrl",
    "original_transaction": {
      "id": "98mjmc70xnjra",
      "card": {
        "id": "9cj2ct706abrx",
        "customer": {
          "id": "94caj820naxrm",
          "last_transaction": {
            "id": "98mjmc70xnjra"
          }
        }
      }
    },
    "created_at": 1593424054,
    "amount": 1024,
    "currency": "eur",
    "description": "Winnings from 2021-06",
    "reference": "b138bc50148440ef",
    "extra_data": {},
    "status": "failed",
    "errors": []
  }
  ],
  "page": 1,
  "per_page": 2,
  "total_count": 2
}

Get a list of credits based on a selected transaction

Returns a list of credits referencing a specified transaction ID.
GEThttps://api.straal.com/v1/transactions/:transaction_id/credits
v1.transactions.credits_list
Sample response (limited to 2 objects):
GET /v1/transactions/98mjmc70xnjra/credits?per_page=2&page=1
{
  "data": [
  {
    "id": "xkjh2wc02asr9",
    "original_transaction": {
      "id": "98mjmc70xnjra",
      "card": {
        "id": "9cj2ct706abrx",
        "customer": {
          "id": "94caj820naxrm",
          "last_transaction": {
            "id": "98mjmc70xnjra"
          }
        }
      }
    },
    "created_at": 1593424054,
    "amount": 999,
    "currency": "eur",
    "description": "Winnings from 2021-05",
    "reference": "b138bc50148440ee",
    "extra_data": {},
    "status": "succeeded",
    "errors": []
  },
  {
    "id": "xscp9jvm8adrl",
    "original_transaction": {
      "id": "98mjmc70xnjra",
      "card": {
        "id": "9cj2ct706abrx",
        "customer": {
          "id": "94caj820naxrm",
          "last_transaction": {
            "id": "98mjmc70xnjra"
          }
        }
      }
    },
    "created_at": 1593424054,
    "amount": 1024,
    "currency": "eur",
    "description": "Winnings from 2021-06",
    "reference": "b138bc50148440ef",
    "extra_data": {},
    "status": "failed",
    "errors": []
  }
  ],
  "page": 1,
  "per_page": 2,
  "total_count": 2
}

Get customer's credits

Returns a list of credits for a specified customer ID.
GEThttps://api.straal.com/v1/customers/:customer_id/credits
v1.customers.credits_list
Sample response (limited to 2 objects):
GET /v1/customers/94caj820naxrm/credits?per_page=2&page=1
{
  "data": [
  {
    "id": "xkjh2wc02asr9",
    "original_transaction": {
      "id": "98mjmc70xnjra",
      "card": {
        "id": "9cj2ct706abrx",
        "customer": {
          "id": "94caj820naxrm",
          "last_transaction": {
            "id": "98mjmc70xnjra"
          }
        }
      }
    },
    "created_at": 1593424054,
    "amount": 999,
    "currency": "eur",
    "description": "Winnings from 2021-05",
    "reference": "b138bc50148440ee",
    "extra_data": {},
    "status": "succeeded",
    "errors": []
  },
  {
    "id": "xscp9jvm8adrl",
    "original_transaction": {
      "id": "98mjmc70xnjra",
      "card": {
        "id": "9cj2ct706abrx",
        "customer": {
          "id": "94caj820naxrm",
          "last_transaction": {
            "id": "98mjmc70xnjra"
          }
        }
      }
    },
    "created_at": 1593424054,
    "amount": 1024,
    "currency": "eur",
    "description": "Winnings from 2021-06",
    "reference": "b138bc50148440ef",
    "extra_data": {},
    "status": "failed",
    "errors": []
  }
  ],
  "page": 1,
  "per_page": 2,
  "total_count": 2
}

Straal Direct payments [BETA]

A Straal Direct payment object represents a Straal Direct payment attempt made by a customer.

Straal Direct payment object attributes

id
string
Straal Direct payment ID
RO
created_at
integer
Time at which the object was created
RO
redirect_url
string
URL to which the end user has to be redirected to make a payment
RO
amount
integer
Transaction amount
currency
string
Transaction currency
return_url
string
URL to which the end user will be redirected after initiated payment
origin_ipaddr
string
IP address from which the Straal Direct payment was created
description
string
Description of the payment
reference
string
Your internal transaction reference (has to be unique)
MAXLEN:32UNIQUE
order_reference
string
Your internal order reference (does not have to be unique)
MAXLEN:32
external_reference
string
Payment reference that can be shown to the end user. This reference will be used in the notification email sent to the end user, etc.
RO
status
string
Current status of the payment. Possible values: pending, initiated, failed
RO
customer
object
Customer for whom the payment is created
ROEXPANDABLE
transaction
object
Transaction associated with created Straal Direct Payment
RO

Straal Direct payment process overview

  1. Start a Straal Direct payment initiation process
  2. Using received redirect_url, redirect your customer.
  3. Customer chooses a bank from the form and proceeds with payment in their bank.
  4. After the customer has completed payment and Straal has it confirmed, the customer is redirected to URL provided in step 1 (return_url)
  5. A straal_direct_payment_initiated or straal_direct_payment_failed event will be sent to your backend, containing the details of the Straal Direct payment. Make sure you've configured notifications.

Things to keep in mind

Start a Straal Direct payment initiation process

This method allows you to start a Straal Direct payment initiation process for a previously created customer object.
POSThttps://api.straal.com/v1/customers/{customer_id}/straal_direct_payments
v1.straal_direct_payments.create
Sample request starting a Straal Direct payment.
{
  "currency": "eur",
  "amount": 1499,
  "return_url": "https://yourproduct.com/payment_initiated",
  "description": "Order 123123",
  "reference": "b13sadkauasdmn",
  "order_reference": "MyRef123",
  "origin_ipaddr": "123.123.123.123",
  "customer_name": "Jan Kowalski"
 }
customer_name is optional. Sample response:
{
   "id": "b138bc50148440ee",
   "created_at": 1472491810,
   "redirect_url": "https://checkout.straal.com/straal_direct_payment_init/some_token",
   "reference": "b13sadkauasdmn",
   "external_reference": "AJASND-SFLSDJH",
   "currency": "eur",
   "amount": 1499,
   "return_url": "https://yourproduct.com/payment_initiated",
   "description": "Order 123123",
   "order_reference": "MyRef123",
   "origin_ipaddr": "123.123.123.123",
   "status": "pending",
   "customer": {
      "id": "cebculc21t6ku",
      "last_transaction": {
         "id": "u0j6kuvwrkcku"
      }
   },
   "transaction": {
      "id": "u0j6kuvwrkcku"
   }
}
It is also possible to supply customer's expected IBAN, using an optional iban field:
{
  "currency": "eur",
  "amount": 1499,
  "return_url": "https://yourproduct.com/payment_initiated",
  "description": "Order 123123",
  "reference": "b13sadkauasdmn",
  "order_reference": "MyRef123",
  "origin_ipaddr": "123.123.123.123",
  "iban": "DE91100000000123456789"
 }
For the countries supported by this feature (currently: Germany), a special bank recognition logic will be then used. If the bank is supported by Straal Direct, the bank selection screen will be skipped in checkout flow. If the bank is not supported, the request will fail with error 22033: "Your bank is not supported".

Deprecated resources

These API methods are deprecated and should not be used in new integrations.

Create a transaction with a card and a customer

This method allows you to perform a transaction, create a card and a customer in one request.
POSThttps://api.straal.com/v1/transactions
v1.transactions.create_with_card_and_customer
Sample request for a $9.99 transaction
{
  "amount": 999,
  "currency": "usd",
  "reference": "b138bc50148440ee",
  "order_reference": null,
  "card": {
    "name": "John Smith",
    "number": "4444444444444448",
    "cvv": "123",
    "expiry_month": 11,
    "expiry_year": 2023,
    "origin_ipaddr": "91.17.133.219",
    "customer": {
      "email": "[email protected]",
      "reference": "auIj01kcj98lfq"
    }
  }
}
Sample response
{
  "id": "f9g63mazh1wi1",
  "attempts": [],
  "with_3ds_params": false,
  "created_at": 1470238921,
  "amount": 999,
  "currency": "usd",
  "method": "card",
  "authorized": true,
  "pre_auth": false,
  "captured": true,
  "captures": [
    {
      "id": "qkymdfy2jbui1",
      "created_at": 1470239156,
      "amount": 999
    }
  ],
  "refunded": false,
  "refunds": [],
  "voided": false,
  "voids": [],
  "chargeback": null,
  "reference": "b138bc50148440ee",
  "external_reference": null,
  "order_reference": null,
  "card": {
    "id": "mzivhql5yi9rf",
    "created_at": 1467906605,
    "brand": "visa",
    "name": "John Smith",
    "num_bin": "444444",
    "num_last_4": "4448",
    "expiry_month": 11,
    "expiry_year": 2023,
    "origin_ipaddr": "91.17.133.219",
    "state": "active",
    "state_flags": [],
    "customer": {
      "id": "mhtaqdb4edvrf",
      "created_at": 1467716585,
      "email": "[email protected]",
      "reference": "auIj01kcj98lfq"
    }
  },
  "decline_reason": null,
  "extra_data": {}
}

Create a card with a customer

POSThttps://api.straal.com/v1/cards
v1.cards.create_with_customer
Sample request:
{
  "name": "John Smith",
  "number": "4444444444444448",
  "cvv": "123",
  "expiry_month": 11,
  "expiry_year": 2023,
  "origin_ipaddr": "91.17.133.219",
  "customer": {
    "email": "[email protected]",
    "reference": "auIj01kcj98lfq"
  }
}
Sample response:
{
  "id": "mzivhql5yi9rf",
  "created_at": 1467906605,
  "state": "active",
  "state_flags": [],
  "brand": "visa",
  "name": "John Smith",
  "num_bin": "444444",
  "num_last_4": "4448",
  "expiry_month": 11,
  "expiry_year": 2023,
  "origin_ipaddr": "91.17.133.219",
  "customer": {
    "id": "mhtaqdb4edvrf",
    "created_at": 1467716585,
    "email": "[email protected]",
    "reference": "auIj01kcj98lfq"
  }
}

Create a bank account with a customer

This method allows you to create a bank account and a customer.
POSThttps://api.straal.com/v1/bank_accounts
v1.bank_accounts.create_with_customer
Sample request:
{
  "name": "John Smith",
  "iban": "DE89370400440532013000",
  "bic": "COBADEFFXXX",
  "origin_ipaddr": "91.17.133.219",
  "customer": {
    "email": "[email protected]",
    "reference": "auIj01kcj98lfq"
  }
}
Sample response:
{
  "id": "83ulegbkuvqmf",
  "created_at": 1487251609,
  "name": "John Smith",
  "iban": "DE89370400440532013000",
  "bic": "COBADEFFXXX",
  "mandate_id": "a84764a157a840daabbc22136ab2b067",
  "origin_ipaddr": "91.17.133.219",
  "customer": {
    "id": "q12l8eww2vymk",
    "created_at": 1487251608,
    "email": "[email protected]",
    "reference": "auIj01kcj98lfq"
  }
}

Create a subscription with a card and a customer

This method allows creating a subscription and a customer using a single request by sending both required objects (card and customer). The card created in this request automatically becomes active, which in practice means that all subscription transactions will be performed using this card.
Notes:
- card and customer objects are required while sending a request to this URL
- when using this method, the credit card needs to be authorized, so Verification Authorization will be made.
- created card and customer objects are added to response when an error occurs during subscription creation. You can use these objects in other views.
POSThttps://api.straal.com/v1/subscriptions
v1.subscriptions.create_with_card_and_customer
Sample request:
{
  "plan_id": "mcn15j2hwhq4f",
  "card": {
    "name": "Samwell Gordon",
    "number": "4444333322221111",
    "cvv": "789",
    "expiry_month": 7,
    "expiry_year": 2019,
    "origin_ipaddr": "54.4.125.235",
    "customer": {
      "email": "[email protected]",
      "reference": 7459320801
    }
  }
}
Sample response:
{
  "id": "m5lwrskt18r4f",
  "created_at": 1468577492,
  "active": true,
  "cancelled_at": null,
  "cancellation_source": null,
  "current_period_start": 1468577492,
  "current_period_end": 1471169492,
  "card": {
    "id": "mru196faf8r4f",
    "created_at": 1468577403,
    "brand": "visa",
    "name": "Samwell Gordon",
    "num_bin": "444433",
    "num_last_4": "1111",
    "expiry_month": 7,
    "expiry_year": 2019,
    "origin_ipaddr": "54.4.125.235",
    "customer": {
      "id": "mj3mg7w3w8r4f",
      "created_at": 1468577694,
      "email": "[email protected]",
      "reference": "7459320801"
    },
    "state": "active",
    "state_flags": [],
    "extra_data": {},
    "transactions": [
      {
        "amount": 100,
        "authorized": true,
        "pre_auth": false,
        "captured": false,
        "captures": [],
        "chargeback": null,
        "created_at": 1468577590,
        "currency": "usd",
        "decline_reason": null,
        "extra_data": {},
        "id": "n4lar14f3a54f",
        "attempts": [],
        "with_3ds_params": false,
        "reference": null,
        "external_reference": null,
        "order_reference": null,
        "refunded": false,
        "refunds": [],
        "voided": false,
        "voids": []
      }
    ]
  },
  "plan": {
    "id": "mcn15j2hwhq4f"
  },
  "extra_data": {},
  "straal_custom_data": {}
}
Sample error response:
{
  "errors": [
    {
      "message": "Authorization failed",
      "code": 60001
    }
  ],
  "plan": {
    "id": "cwssdg3d951dt"
  },
  "card": {
    "id": "mru196faf8r4f",
    "created_at": 1468577403,
    "brand": "visa",
    "name": "Samwell Gordon",
    "num_bin": "444433",
    "num_last_4": "1111",
    "expiry_month": 7,
    "expiry_year": 2019,
    "origin_ipaddr": "54.4.125.235",
    "customer": {
      "id": "mj3mg7w3w8r4f",
      "created_at": 1522238802,
      "email": "[email protected]",
      "reference": "7459320801"
    },
    "state": "active",
    "state_flags": [],
    "extra_data": {},
    "transactions": [
      {
        "amount": 100,
        "authorized": false,
        "captured": false,
        "captures": [],
        "chargeback": null,
        "created_at": 1468577590,
        "currency": "usd",
        "decline_reason": {
          "code": 1001,
          "description": "General decline"
        },
        "extra_data": {},
        "id": "n4lar14f3a54f",
        "attempts": [],
        "with_3ds_params": false,
        "reference": null,
        "external_reference": null,
        "order_reference": null,
        "refunded": false,
        "refunds": [],
        "voided": false,
        "voids": []
      }
    ]
  },
  "extra_data": {}
}

Straal.js

Overview

Straal.js is a helper library to make it easier to make API requests directly from the merchant's website. It utilizes client-side encryption and sends data over HTTPS to perform secure transactions.

Download

You can download Straal.js from Straal GitHub

Usage

In order to perform a transaction request directly from your website you have to do the following:

1. Create a CryptKey on your application backend.
2. Pass the generated CryptKey to the frontend part of your site (via request or templating).
3. Pass CryptKey into Straal.js client code.

Notifications

Overview

Straal can notify your backend about certain events. For example, when we charge customer subscription, or after a transaction performed by your user from a mobile device. The notification is a regular HTTP request with JSON-formatted data.

Request finished

Event name: request_finished

If you are using Straal Checkout Page, we strongly recommend you handle the Checkout attempt finished notification instead.

When configured, this notification is sent each time when a transaction-related request is made. It contains the entire response body along with some extra information. Configuring this notification is highly recommended for clients sending encrypted requests directly from their website or a mobile device.
You can filter out the most relevant notifications by by checking the permission field in the data object.

Sample notification:
{
  "event": "request_finished",
  "data": {
    "path": "/v1/cards/mzivhql5yi9rf/transactions",
    "permission": "v1.transactions.create",
    "auth_method": "cryptkey",
    "cryptkey": {
      "id": "70xfzmynzgkih"
    },
    "request_id": "0e04ead77926441c9369f1932ddd13c8",
    "response": {
      "id": "f9g63mazh1wi1",
      "attempts": [],
      "with_3ds_params": false,
      "created_at": 1470238921,
      "amount": 999,
      "currency": "usd",
      "authorized": true,
      "pre_auth": false,
      "captured": true,
      "captures": [
        {
          "id": "qkymdfy2jbui1",
          "created_at": 1470239156,
          "amount": 999
        }
      ],
      "refunded": false,
      "refunds": [],
      "voided": false,
      "voids": [],
      "chargeback": null,
      "reference": "b138bc50148440ee",
      "external_reference": null,
      "order_reference": null,
      "card": {
        "id": "mzivhql5yi9rf",
        "customer": {
          "id": "mhtaqdb4edvrf"
        }
      },
      "decline_reason": null,
      "extra_data": {}
    }
  }
}

Checkout Page

These notifications are sent only for transactions made via Straal Checkout Page.

Checkout attempt finished

Event name: checkout_attempt_finished

This notification is sent when a single payment attempt via Straal Checkout Page is finished.

Sample notification:
{
  "event": "checkout_attempt_finished",
  "data": {
    "checkout": {
      "id": "iqxjxcr01hcko",
      "af_profiling_reference": null,
      "af_user_reference": null,
      "amount": 1000,
      "checkout_url": "https://checkout.straal.com/f4k3",
      "created_at": 1554385200,
      "currency": "pln",
      "customer": {
        "id": "c0cxh9x04xikh"
      },
      "extra_data": {},
      "failure_url": "https://yourproduct.com/payment_succeeded",
      "merchant_image": null,
      "order_description": null,
      "order_reference": "some_order_reference",
      "return_url": "https://yourproduct.com/payment_failed",
      "ttl": 600,
      "use_3ds": true
    },
    "checkout_attempt": {
      "id": "hj9cxs20d0cki",
      "af_attempt_reference": null,
      "authentication_3ds": {
          "id": "dfa234gatkgh5",
          "card": {
              "id": "xupuuc40ihukc",
              "customer": {
                  "id": "c0cxh9x04xikh"
              }
          }
      },
      "created_at": 1554385200,
      "profiler_url": "https://profiler.com/some_profiling_script.js",
      "session_reference": "778779f3ba974afbab8b7133b6094f96",
      "status": "succeeded"
    },
    "transaction": {
      "id": "cxjepxt0ihck2",
      "amount": 1000,
      "attempts": [],
      "with_3ds_params": true,
      "authorized": true,
      "pre_auth": false,
      "captured": true,
      "captures": [
        {
          "id": "e5iraxm0ajckq",
          "amount": 1000,
          "status": "succeeded",
          "created_at": 1554385200,
          "extra_data": {}
        }
      ],
      "card": {
        "id": "xupuuc40ihukc",
        "customer": {
          "id": "c0cxh9x04xikh",
          "last_transaction": {
            "id": "cxjepxt0ihck2"
          }
        }
      },
      "chargeback": null,
      "created_at": 1554385200,
      "currency": "pln",
      "decline_reason": null,
      "method": "card",
      "reference": "some_order_reference",
      "external_reference": null,
      "refunded": false,
      "voided": false,
      "extra_data": {}
    }
  }
}

Reconciliations

These notifications are sent only for SEPA Direct Debit transactions.

Authorized

Event name: authorized

This notification is sent when a SEPA Direct Debit transaction is settled.

Sample notification:
{
  "event": "authorized",
  "data": {
    "transaction": {
      "id": "f9g63mazh1wi1",
      "attempts": [],
      "with_3ds_params": false,
      "created_at": 1470238921,
      "amount": 999,
      "currency": "eur",
      "method": "sepa",
      "authorized": true,
      "pre_auth": false,
      "captured": false,
      "captures": [],
      "refunded": false,
      "refunds": [],
      "voided": false,
      "voids": [],
      "chargeback": null,
      "reference": "b138bc50148440ee",
      "external_reference": null,
      "order_reference": null,
      "bank_account": {
        "id": "83ulegbkuvqmf",
        "customer": {
          "id": "mhtaqdb4edvrf"
        }
      },
      "status": "succeeded",
      "decline_reason": null,
      "extra_data": {}
    },
    "timestamp": 1487440567
  }
}

Authorize failed

Event name: authorize_failed

This notification is sent when a SEPA Direct Debit transaction is declined.

Sample notification:
{
  "event": "authorize_failed",
  "data": {
    "transaction": {
      "id": "f9g63mazh1wi1",
      "attempts": [],
      "with_3ds_params": false,
      "created_at": 1470238921,
      "amount": 999,
      "currency": "eur",
      "method": "sepa",
      "authorized": false,
      "captured": false,
      "captures": [],
      "refunded": false,
      "refunds": [],
      "voided": false,
      "voids": [],
      "chargeback": null,
      "reference": "b138bc50148440ee",
      "external_reference": null,
      "order_reference": null,
      "bank_account": {
        "id": "83ulegbkuvqmf",
        "customer": {
          "id": "mhtaqdb4edvrf"
        }
      },
      "status": "failed",
      "decline_reason": {
        "code": 1001,
        "description": "General decline"
      },
      "extra_data": {}
    },
    "timestamp": 1487440567
  }
}

Refund succeeded

Event name: refund_succeeded

This notification is sent when a SEPA Direct Debit transaction refund is settled.

Sample notification for a partial refund:
{
  "event": "refund_succeeded",
  "data": {
    "transaction": {
      "id": "f9g63mazh1wi1",
      "attempts": [],
      "with_3ds_params": false,
      "created_at": 1470238921,
      "amount": 999,
      "currency": "eur",
      "method": "sepa",
      "authorized": true,
      "pre_auth": false,
      "captured": false,
      "captures": [],
      "refunded": false,
      "refunds": [
        {
          "id": "mkwsfft8hn66y",
          "created_at": 1472473029,
          "amount": 900,
          "status": "succeeded",
          "extra_data": {}
        }
      ],
      "voided": false,
      "voids": [],
      "chargeback": null,
      "reference": "b138bc50148440ee",
      "external_reference": null,
      "order_reference": null,
      "bank_account": {
        "id": "83ulegbkuvqmf",
        "customer": {
          "id": "mhtaqdb4edvrf"
        }
      },
      "status": "partially_refunded",
      "decline_reason": null,
      "extra_data": {}
    },
    "timestamp": 1487440567
  }
}

Sample notification for a full refund:
{
  "event": "refund_succeeded",
  "data": {
    "transaction": {
      "id": "f9g63mazh1wi1",
      "attempts": [],
      "with_3ds_params": false,
      "created_at": 1470238921,
      "amount": 999,
      "currency": "eur",
      "method": "sepa",
      "authorized": true,
      "pre_auth": false,
      "captured": false,
      "captures": [],
      "refunded": true,
      "refunds": [
        {
          "id": "mkwsfft8hn66y",
          "created_at": 1472473029,
          "amount": 999,
          "status": "succeeded",
          "extra_data": {}
        }
      ],
      "voided": false,
      "voids": [],
      "chargeback": null,
      "reference": "b138bc50148440ee",
      "external_reference": null,
      "order_reference": null,
      "bank_account": {
        "id": "83ulegbkuvqmf",
        "customer": {
          "id": "mhtaqdb4edvrf"
        }
      },
      "status": "refunded",
      "decline_reason": null,
      "extra_data": {}
    },
    "timestamp": 1487440567
  }
}

Refund failed

Event name: refund_failed

This notification is sent when a SEPA Direct Debit transaction refund is declined.

Sample notification:
{
  "event": "refund_failed",
  "data": {
    "transaction": {
      "id": "f9g63mazh1wi1",
      "attempts": [],
      "with_3ds_params": false,
      "created_at": 1470238921,
      "amount": 999,
      "currency": "eur",
      "method": "sepa",
      "authorized": true,
      "pre_auth": false,
      "captured": false,
      "captures": [],
      "refunded": false,
      "refunds": [
        {
          "id": "mkwsfft8hn66y",
          "created_at": 1472473029,
          "amount": 999,
          "status": "failed",
          "extra_data": {}
        }
      ],
      "voided": false,
      "voids": [],
      "chargeback": null,
      "reference": "b138bc50148440ee",
      "external_reference": null,
      "order_reference": null,
      "bank_account": {
        "id": "83ulegbkuvqmf",
        "customer": {
          "id": "mhtaqdb4edvrf"
        }
      },
      "status": "succeeded",
      "decline_reason": null,
      "extra_data": {}
    },
    "timestamp": 1487440567
  }
}

Chargeback

Event name: sepa_transaction_chargeback

This notification is sent when a SEPA Direct Debit transaction is charged back.

Sample notification:
{
  "event": "sepa_transaction_chargeback",
  "data": {
    "transaction": {
      "id": "f9g63mazh1wi1",
      "attempts": [],
      "with_3ds_params": false,
      "created_at": 1470238921,
      "amount": 999,
      "currency": "eur",
      "method": "sepa",
      "authorized": true,
      "pre_auth": false,
      "captured": false,
      "captures": [],
      "refunded": false,
      "refunds": [],
      "voided": false,
      "voids": [],
      "chargeback": {
        "id": "gnranrehp3gl6",
        "effective_date": 1486684800,
        "reason_code": "MD06",
        "reason_description": "Disputed authorised transaction"
      },
      "reference": "b138bc50148440ee",
      "external_reference": null,
      "order_reference": null,
      "bank_account": {
        "id": "83ulegbkuvqmf",
        "customer": {
          "id": "mhtaqdb4edvrf"
        }
      },
      "status": "chargeback",
      "decline_reason": null,
      "extra_data": {}
    },
    "timestamp": 1487440567
  }
}

Transactions

Card transaction chargeback

Event name: card_transaction_chargeback

This notification is sent when a credit card transaction is charged back.

Sample notification:
{
  "event": "card_transaction_chargeback",
  "data": {
    "transaction": {
      "id": "pzhazstgsj497",
      "attempts": [],
      "with_3ds_params": false,
      "created_at": 1521729203,
      "amount": 999,
      "currency": "usd",
      "method": "card",
      "authorized": true,
      "pre_auth": false,
      "captured": true,
      "refunded": false,
      "voided": false,
      "captures": [
        {
          "id": "s2xcew6gsj79p"
        }
      ],
      "refunds": [],
      "voids": [],
      "card": {
        "id": "pzhazstgsj497",
          "customer": {
            "id": "s713n8vgsj79p"
          }
      },
      "chargeback": {
        "id": "zy8clu5y8bzve",
        "effective_date": 1577923200,
        "reason_code": "62",
        "reason_description": "Counterfeit Transaction",
        "arn": "12345678901234567890123"
      },
      "reference": "ieph3wow3Hooch4b",
      "external_reference": null,
      "order_reference": null,
      "decline_reason": null,
      "extra_data": {}
    },
    "timestamp": 1577934248
  }
}

Subscriptions

Recurring payment succeeded

Event name: recurring_payment_succeeded

This notification is sent when a recurring payment (i.e. billing according to the subscription's plan) succeeds.

Sample notification:
{
     "event": "recurring_payment_succeeded",
     "data": {
         "transaction": {
             "id": "f9g63mazh1wi1",
             "attempts": [],
             "with_3ds_params": false,
             "created_at": 1470238921,
             "amount": 2000,
             "currency": "usd",
             "method": "card",
             "authorized": true,
             "pre_auth": false,
             "captured": true,
             "refunded": false,
             "voided": false,
             "captures": [{
                 "id": "qkymdfy2jbui1",
                 "created_at": 1470239156,
                 "amount": 2000
             }],
             "refunds": [],
             "voids": [],
             "card": {
                 "id": "mzivhql5yi9rf",
                 "customer": {
                     "id": "mhtaqdb4edvrf"
                 }
             },
             "decline_reason": null,
             "extra_data": {}
         },
         "subscription": {
             "id": "m5lwrskt18r4f",
             "created_at": "1468577492",
             "active": true,
             "cancelled_at": null,
             "cancellation_source": null,
             "current_period_start": 1468577492,
             "current_period_end": 1471169492,
             "card": {
                 "id": "mzivhql5yi9rf",
                 "customer": {
                     "id": "mhtaqdb4edvrf"
                 }
             },
             "plan": {
                 "id": "mcn15j2hwhq4f"
             },
             "extra_data": {}
         }
     }
}

Recurring payment failed

Event name: recurring_payment_failed

This notification is sent when a recurring payment fails.

Sample notification:
{
     "event": "recurring_payment_failed",
     "data": {
         "transaction": {
             "id": "f9g63mazh1wi1",
             "attempts": [],
             "with_3ds_params": false,
             "created_at": 1470238921,
             "amount": 2000,
             "currency": "usd",
             "method": "card",
             "authorized": false,
             "captured": false,
             "refunded": false,
             "voided": false,
             "captures": [],
             "refunds": [],
             "voids": [],
             "card": {
                 "id": "mzivhql5yi9rf",
                 "customer": {
                     "id": "mhtaqdb4edvrf"
                 }
             },
             "decline_reason": {
                 "code": 1001,
                 "description": "General decline"
             },
             "extra_data": {}
         },
         "subscription": {
             "id": "m5lwrskt18r4f",
             "created_at": "1468577492",
             "active": true,
             "cancelled_at": null,
             "cancellation_source": null,
             "current_period_start": 1468577492,
             "current_period_end": 1471169492,
             "card": {
                 "id": "mzivhql5yi9rf",
                 "customer": {
                     "id": "mhtaqdb4edvrf"
                 }
             },
             "plan": {
                 "id": "mcn15j2hwhq4f"
             },
             "extra_data": {}
         }
     }
}

Subscription cancelled

Event name: subscription_cancelled

This notification is sent when a subscription is cancelled.

Sample notification:
{
    "event": "subscription_cancelled",
    "data": {
        "subscription": {
            "id": "m5lwrskt18r4f",
            "created_at": 1468577492,
            "active": false,
            "cancelled_at": 1468671650,
            "cancellation_source": {
                "code": 1,
                "description": "API request"
            },
            "current_period_start": 1468577492,
            "current_period_end": 1471169492,
            "card": {
                "id": "mzivhql5yi9rf",
                "customer": {
                    "id": "mhtaqdb4edvrf"
                }
            },
            "plan": {
                 "id": "mcn15j2hwhq4f"
             },
             "extra_data": {},
             "straal_custom_data": {}
        }
    }
}
Event name: pay_by_link_payment_succeeded

This notification is sent when a pay-by-link payment succeeds.

Sample notification:
{
  "event": "pay_by_link_payment_succeeded",
  "data": {
    "transaction": {
      "id": "f9g63mazh1wi1",
      "attempts": [],
      "with_3ds_params": false,
      "created_at": 1470238921,
      "amount": 1499,
      "currency": "pln",
      "method": "pay_by_link",
      "authorized": false,
      "captured": false,
      "refunded": false,
      "voided": false,
      "captures": [],
      "refunds": [],
      "voids": [],
      "chargeback": null,
      "reference": null,
      "external_reference": null,
      "order_reference": null,
      "decline_reason": null,
      "pay_by_link_payment": {
        "id": "fjdan27fk72na",
        "created_at": 1472491810,
        "redirect_url": "https://bank1.example.com",
        "currency": "pln",
        "amount": 1499,
        "return_url": "https://yourproduct.com/payment_succeeded",
        "failure_url": "https://yourproduct.com/payment_failed",
        "description": "Order 123123",
        "reference": "qwerty1234qwerty",
        "order_reference": null,
        "origin_ipaddr": "123.123.123.123",
        "payment_method_ident": "bank1",
        "external_reference": "ABC123123ABC",
        "status": "succeeded",
        "customer": {
          "id": "mhtaqdb4edvrf",
          "last_transaction": {
            "id": "f9g63mazh1wi1"
          }
        }
      },
      "extra_data": {}
    }
  }
}
Event name: pay_by_link_payment_failed

This notification is sent when a pay-by-link payment fails.

Sample notification:
{
  "event": "pay_by_link_payment_failed",
  "data": {
    "transaction": {
      "id": "f9g63mazh1wi1",
      "attempts": [],
      "with_3ds_params": false,
      "created_at": 1470238921,
      "amount": 1499,
      "currency": "pln",
      "method": "pay_by_link",
      "authorized": false,
      "captured": false,
      "refunded": false,
      "voided": false,
      "captures": [],
      "refunds": [],
      "voids": [],
      "chargeback": null,
      "reference": null,
      "external_reference": null,
      "order_reference": null,
      "decline_reason": null,
      "pay_by_link_payment": {
        "id": "fjdan27fk72na",
        "created_at": 1472491810,
        "redirect_url": "https://bank1.example.com",
        "currency": "pln",
        "amount": 1499,
        "return_url": "https://yourproduct.com/payment_succeeded",
        "failure_url": "https://yourproduct.com/payment_failed",
        "description": "Order 123123",
        "reference": "qwerty1234qwerty",
        "order_reference": null,
        "origin_ipaddr": "123.123.123.123",
        "payment_method_ident": "bank1",
        "external_reference": "ABC123123ABC",
        "status": "failed",
        "customer": {
          "id": "mhtaqdb4edvrf",
          "last_transaction": {
            "id": "f9g63mazh1wi1"
          }
        }
      },
      "extra_data": {}
    }
  }
}

Straal Direct payments

Straal Direct payment initiated

Event name: straal_direct_payment_initiated

This notification is sent when the Straal Direct payment has been initiated. Please note: this means that the payment initiation has been successful, but it does not mean that the related bank transfer has been completed.

As access to this information varies between banks and countries, payer_iban and payer_name may be empty in some cases, even when payment initiation was successful.

Sample notification:
{
    "data": {
        "transaction": {
            "id": "f9g63mazh1wi1",
            "voids": [],
            "amount": 1499,
            "method": "straal_direct",
            "voided": false,
            "refunds": [],
            "attempts": [],
            "with_3ds_params": false,
            "captured": false,
            "captures": [],
            "currency": "eur",
            "refunded": false,
            "reference": "b13sadkauasdmn",
            "external_reference": "AJASND-SFLSDJH",
            "authorized": false,
            "chargeback": null,
            "created_at": 1570707755,
            "extra_data": {},
            "decline_reason": null,
            "order_reference": "MyRef123",
            "status": "initiated",
            "straal_direct_payment": {
                "id": "68clmu86l6zfl",
                "amount": 1499,
                "currency": "eur",
                "customer": {
                    "id": "lccil6ig06ufi",
                    "last_transaction": {
                        "id": "6qcuu6a6p2efl"
                    }
                },
                "external_reference": "AJASND-SFLSDJH",
                "created_at": 1570707755,
                "return_url": "https://yourproduct.com/payment_initiated",
                "description": "Order 123123",
                "redirect_url": "https://checkout.straal.com/straal_direct_payment_init/some_token",
                "origin_ipaddr": "123.123.123.123",
                "payer_iban": "DE89370400440532013000",
                "payer_name": "Wissowa, Georg"
            }
        }
    },
    "event": "straal_direct_payment_initiated"
}

Straal Direct payment failed

Event name: straal_direct_payment_failed

This notification is sent when the Straal Direct payment fails.

Sample notification:
{
    "data": {
        "transaction": {
            "id": "f9g63mazh1wi1",
            "voids": [],
            "amount": 1499,
            "method": "straal_direct",
            "voided": false,
            "refunds": [],
            "attempts": [],
            "with_3ds_params": false,
            "captured": false,
            "captures": [],
            "currency": "eur",
            "refunded": false,
            "reference": "b13sadkauasdmn",
            "external_reference": "AJASND-SFLSDJH",
            "authorized": false,
            "chargeback": null,
            "created_at": 1570707755,
            "extra_data": {},
            "decline_reason": null,
            "order_reference": "MyRef123",
            "status": "failed",
            "straal_direct_payment": {
                "id": "68clmu86l6zfl",
                "amount": 1499,
                "currency": "eur",
                "customer": {
                    "id": "lccil6ig06ufi",
                    "last_transaction": {
                        "id": "6qcuu6a6p2efl"
                    }
                },
                "external_reference": "AJASND-SFLSDJH",
                "created_at": 1570707755,
                "return_url": "https://yourproduct.com/payment_succeeded",
                "description": "Order 123123",
                "redirect_url": "https://checkout.straal.com/straal_direct_payment_init/some_token",
                "origin_ipaddr": "123.123.123.123",
                "payer_iban": null,
                "payer_name": null
            }
        }
    },
    "event": "straal_direct_payment_failed"
}