HomeProduct DocsAPI ReferenceChangelog
RecurlyAPI GuidesRecurly.jsWebhooksAPI ReferenceSupportBook demo
API Reference

Create Transaction

The endpoint provides a shortcut for creating an invoice, charge, and optionally account, and processing the payment immediately. When creating an account all of the required account attributes must be supplied. When charging an existing account only the account_code must be supplied.

Deprecated in favor of Purchases

We recommend use the Create Purchase endpoint instead of this one. With it you can create an account, billing info, multiple charges, credits and subscriptions, and invoice and collect payment processed in one step.

Using Stored Billing Info

You may create a transaction without specifying billing information if an account already has stored billing information.

xml

PHP

Ruby

Python

Dotnet

<transaction>
  <amount_in_cents>100</amount_in_cents>
  <currency>USD</currency>
  <account>
    <account_code>1</account_code>
  </account>
</transaction>
$transaction = new Recurly_Transaction();
$transaction->amount_in_cents = 100; // $1.00
$transaction->currency = 'USD';

$transaction->account = new Recurly_Account();
$transaction->account->account_code = '1';

$transaction->create();
transaction = account.transactions.create(
  :amount_in_cents => 1_00,
  :currency        => 'USD',
  :account         => { :account_code => '1' }
)
transaction = Transaction(
  amount_in_cents=100,
  currency='USD',
  account=Account(account_code='1')
)
transaction.save()
var transaction = new Transaction("1", 100, "USD"); // account code, unit amount in cents, currency
transaction.Create();
Using Existing Billing Info

After a successful transaction, the billing information will be saved with the account for future purchases. If the account already has stored billing info, the billing info from the last transaction overwrite the previous values.

xml

PHP

Ruby

Python

Dotnet

<transaction>
  <amount_in_cents>1000</amount_in_cents>
  <currency>USD</currency>
  <account>
    <account_code>1</account_code>
    <billing_info>
      <first_name>Verena</first_name>
      <last_name>Example</last_name>
      <address1>123 Main St.</address1>
      <city>San Francisco</city>
      <zip>94105</zip>
      <country>US</country>
      <number>4111-1111-1111-1111</number>
      <verification_value>123</verification_value>
      <month>11</month>
      <year>2015</year>
    </billing_info>
  </account>
</transaction>
$transaction = new Recurly_Transaction();
$transaction->amount_in_cents = 1000; // $10.00.
$transaction->currency = 'USD';

$account = new Recurly_Account();
$account->account_code = '1';

$billing_info = new Recurly_BillingInfo();
$billing_info->first_name = 'Verena';
$billing_info->last_name = 'Example';
$billing_info->number = '4111-1111-1111-1111';
$billing_info->verification_value = '123';
$billing_info->month = 11;
$billing_info->year = 2015;

$account->billing_info = $billing_info;
$transaction->account = $account;

$transaction->create();
transaction = Recurly::Transaction.create(
  :amount_in_cents => 10_00,
  :currency        => 'USD',
  :account         => {
    :account_code => '1',
    :billing_info => {
      :first_name         => 'Verena',
      :last_name          => 'Example',
      :number             => '4111-1111-1111-1111',
      :verification_value => '123',
      :month              => 11,
      :year               => 2015
    }
  }
)
transaction = Transaction(
  amount_in_cents=1000,
  currency='USD',
  account=Account(
    account_code=account_code,
    billing_info=BillingInfo(
      first_name='Verena',
      last_name='Example',
      number='4111-1111-1111-1111',
      verification_value='123',
      year=2015',
      month=11
    )
  )
)
transaction.save()
var account = Accounts.Get("1");
account.BillingInfo = new BillingInfo(account.AccountCode)
{
	FirstName = "Verana",
	LastName = "Example",
	CreditCardNumber = "4111-1111-1111-1111",
	VerificationValue = "123",
	ExpirationYear = 2015,
	ExpirationMonth = 11
};
var transaction = new Transaction(account, 100, "USD");
transaction.Create();
Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Body Params
integer
required

Amount of the transaction in cents. Max 10000000.

string
required

3-letter currency for the transaction

account
object
required

nested attributes (see below)

string
required

A unique identifier used by your application to identify the account. This code may only contain the following characters: [a-z A-Z 0-9 @ - _ .]. Max of 50 characters.

string

A description for the transaction. Description is added to the invoiced charge, and not the transaction object

string

Username, ignore if you do not use usernames

string

Email address

string
required

First Name. Max 50 characters.

string
required

Last Name. Max 50 characters.

string

Company name. Max of 50 characters.

string

An ISO 639-1 language code from the user's browser, indicating their preferred language and locale.

billing_info
object
required

account->billing_info nested attributes (see below)

string

Company name. Max of 50 characters.

string

Address line 1, recommended for address validation. Max 50 characters.

string

Address line 2. Max 50 characters.

string

City. Max 50 characters. Strongly Recommended

string

State or Province, 2-letters preferred

string

Country, 2-letter ISO code. Strongly Recommended

string

Zip or postal code, recommended for address validation. Strongly Recommended

string

Phone number

string

Customer's VAT Number

string

Customer's IP address when updating their billing information. Strongly Recommended.

string
required

Credit card number, spaces and dashes are accepted.

string
required

Expiration Month

string
required

Expiration Year

string

Security code or CVV, 3-4 digits. Strongly Recommended.

string

Accounting code. Max of 20 characters.

boolean
Defaults to false

true exempts tax on the charge, false applies tax on the charge. If not defined, defaults to false.

string
length ≤ 50

Optional field used by Avalara, Vertex, and Recurly's In-the-Box tax solution to determine taxation rules. You can pass in specific tax codes using any of these tax integrations. For Recurly's In-the-Box tax offering you can also choose to instead use simple values of unknown, physical, or digital tax codes.

string

The product code or SKU of the line item. Max of 50 characters. Useful for later reporting on product purchases. Note: this will not be returned in the create transaction response, but it will show on the associated adjustment object if it was set while creating a transaction.

Responses

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