Create charge

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

A charge is created by providing order details (if not existing invoice) and a payment source. The response is a HTTP 200 if the request is understood and processed by Frisbii Billing and Pay, but not necessarily with succesful charge. The HTTP status code relates to the communication with Frisbii Billing and Pay and Frisbii Billing and Pays ability to process the request, not the result of the charge. The result of the charge operation should be determined from the state parameter which will be settled, authorized, failed or pending. Errors relating to the payment method or acquirer processing, e.g. insufficient funds, or processing errors at the acquirer, will result in a HTTP 200 OK with a charge object with state failed and error indication in the error_state and error parameters. If the charge is failed it can be retried with the same handle. The pending state is only used for asynchronous payment methods (e.g. MobilePay Subscriptions) where the result of the charge operation is not known immediately. Webhooks must be used to listen for the state change. Card payments are always synchronous.

Even though the handle can be up to 255 characters it is not recommended to use more than 20 characters as this will allow for the use of handle as reference on bank statements without truncation.

Below is given recommended error handling for the charge operation.

ErrorHandling
Communication error (no HTTP respoonse)
or HTTP server error 5xx
Retry operation immediately or later, preferably with an idempotency key. Retry is important if instant settle is used as the settle operation can actually have gone through so money has been moved.
HTTP 400 client error and error code 147The stored payment method referenced is in state failed, and it is not allowed to make charges because of scheme or payment provider rules. E.g. Visa Token Service token. Treat this the same way as a hard decline and mark payment method as failed and not eligible for use.
Other HTTP 4xx client errors Check your implementation. One error that can be expected is that invoice is already authorized or settled if no idempotency key is used and there has been a retry.
Other non 200 HTTP responseSomething is wrong. Handle as for communication error and contact Frisbii Billing and Pay if the problem persists.
state = authorized or state = settledSuccess
state = pendingThe charge has successfully been sent for asynchronous processing. The result of the charge will be given in webhook, or the state of the charge can be polled with get charge.
error_state = hard_declinedThe charge operation has been declined by acquirer or issuer. The hard decline means that no further attempts should be made using the same payment method. All subsequent attempts will fail. See below for potential scheme fees in case of excessive retrying.
error_state = soft_declinedThe charge operation has been declined by acquirer or issuer with a soft decline. This is ususally due to insufficient funds. Future attempts may succeed. See below for recommendation regarding retries and potential scheme fee in case of excessive retrying.
error_state = processing_errorA processing error can happen if something goes wrong at, or in between, any of the parties involved in a transaction. A processing error can potentially have resulted in a successful charge, but the result never reaches Frisbii Billing and Pay. E.g. a timeout somewhere in the chain. Processing errors leading to transactions actually having been completed without knowing the result is frustrating, but luckily quite rare. We recommend to retry later on a processing error but if the error persists for days the payment method should be marked as failed.

Retries

Schemes have implemented fees on excessive retries to enforce their rules prohibiting excessive payment reattempts. Visa’s rules broadly prohibit more than 15 retries of a single payment over 30 calendar days. Mastercard disallows more than 10 reattempts within a 24-hour period. We recommend not to retry hard declined cards and limit retrying on soft declines to once every 24 hours and at most 15 times.

Errors

The operation can generate the following errors beside the generic HTTP error codes described here.

Error code HTTP codeDescription
79400Invoice already settled
105400Invoice already authorized
29 400Invoice already cancelled
71400The customer is deleted
11400Duplicate customer handle provided
18 400Customer could not be determined from either reference, create customer object or payment method source
99 400Customer object given does not match handle of existing customer or handle given does not match existing customer reference
40404Payment method not found
34400Invalid card token
24400No amount or order lines was provided
80400Existing charge has processing transactions
100400Amount change is not allowed when charging an existing invoice
72400Currency change not allowed on existing invoice or charge
147400Stored payment method is in failed state and it is not allowed to retry because of scheme or payment provider rules
Body Params
string
required
length ≥ 1

Per account unique reference to charge/invoice. E.g. order id from own system.
Multiple payments can be attempted for the same handle but only one authorized or settled charge can exist per handle.
Max length 255 with allowable characters [a-zA-Z0-9_.-@].
It is recommended to use a maximum of 20 characters as this will allow for the use of handle as reference on bank statements without truncation.
If Danish Dankort is supported a maximum of 11 characters should be used.

string

Optional idempotency key. Only one authorization or settle can be performed for the same handle. If two create attempts are attempted and the first succeeds the second will fail because charge is already settled or authorized. An idempotency key identifies uniquely the request and multiple requests with the same key and handle will yield the same result. In case of networking errors the same request with same key can safely be retried.

int32
≥ 1

Amount in the smallest unit. Either amount or order_lines must be provided if charge/invoice does not already exists.

string

Optional currency in ISO 4217 three letter alpha code. If not provided the account default currency will be used. The currency of an existing charge or invoice cannot be changed.

customer
object

Create customer object

metadata
object

Custom metadata.

string
required
length ≥ 1

The source for the payment. Either an existing payment method for the customer or a card token ct_.... The existing payment method can either be referenced directly with id, e.g. ca_..., or the keyword auto can be given to indicate that the newest active customer payment method should be used.

boolean

Whether or not to immediately settle the charge. If not settled immediately the charge will be authorized and can later be settled. Normally this have to be done within 7 days. The default is not to settle the charge immediately. Note that not all payment methods support immediate settle.

boolean

If set and the source is a token for a payment method that supports recurring charging (e.g. credit card), a recurring payment method is stored for the customer and a reference returned.

parameters
object

Extra optional parameters that may be added for specific payment methods.

string

Optional order text. Used in conjunction with amount. Ignored if order_lines is provided.

order_lines
array of objects
length between 0 and 1000

Order lines for the charge. The order lines controls the amount. Only required if charge/invoice does not already exist. If given for existing charge the order lines and amount are adjusted. A maximum of 100 order lines is allowed.

order_lines
string

Customer reference. If charge does not already exist either this reference must be provided, a create customer object must be provided or the source must be a payment method reference (e.g. ca_..) identifying customer. Notice that customer cannot be changed for existing charge/invoice so if handle is provided it must match the customer handle for existing customer.

billing_address
object

Optional billing address

shipping_address
object

Optional shipping address

boolean

When used with a subscription invoice the subscription payment method will be updated. If the subscription is pending the subscription will be activated with the payment method. The recurring argument is set to true.

string

Optional argument to define the text on bank statement. Notice the following about this argument: 1. It only works for some acquirers. 2. Acquirers may have rigid rules on the content of the text on statement. Not complying to these rules will result in declined payments. 3) It is already possible to define custom text on statement using templating in the Frisbii Administration. Contact support for help. We highly recommend to only supply this argument if absolutely necessary, and the templated default text on statement is not sufficient. Maximum length is 128, but most acquirers require a maximum length of 22 characters. Truncating will be applied if too long for specific acquirer. Characters must match regex [\x20-\x7F]

string

Optional reference given to the created payment method in case recurring argument is used to save payment method. Max length 64 with allowable characters [a-zA-Z0-9_.-@].

boolean

For payment methods that supports both synchronous and asynchronous handling this parameter can be used force a specific handling. Asynchronous handling means that a pending state will be returned. The subsequent state change can be registered by using webhooks. The default depends on the payment method.

string

Optional reference for the transaction at the acquirer. Notice the following about this argument:

  1. It only works for some acquirers.
  2. Acquirers may have rigid rules on the content of the acquirer reference.
    Not complying to these rules can result in declined payments.
  3. It is already possible to define custom acquirer reference using templating in the Frisbii Administration.
    Contact support for help. We highly recommend to only supply this argument if absolutely necessary,
    and the templated default acquirer reference is not sufficient. Maximum length is 128,
    but most acquirers require a maximum length of 20 characters.
    Truncating will be applied if too long for specific acquirer.
    If Danish Dankort is supported a maximum of 11 characters should be used.
    Characters must match regex [\x20-\x7F]
account_funding_information
object

Optional sender information required for Account Funding Transaction (AFT).
If not provided when requesting account funding transaction with account_funding=true,
information will be gathered from invoice billing address and customer.

boolean

Indicates that Account Funding Transaction (AFT) is requested.
It only can be used for instant settle (i.e. 'settle' = true)

Responses

Language
Credentials
Basic
base64
:
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json