Skip to content

Create a One-Time Charge

Creates a single, one-time charge that requires seller approval. Once created, redirect the seller to the returned confirmation_url. After the seller responds, YouCan redirects them to your return_url.

Endpoint: https://api.youcan.shop/billing/apps/charges/onetime

Method: POST

TIP

Raw amounts work without any catalog. For your standard tiers, prefer referencing a pricing plan by handle, so your listing and your charges cannot drift apart.

Parameters

ParameterTypeRequiredValidationDescription
namestringYesmax:255Display name shown to the seller on the confirmation page.
return_urlstringYesurl, max:2048URL to redirect the seller to after they approve or decline.
plan_handlestringNomax:64Handle of a pricing plan. The charge is priced from the plan.
price.amountnumericYes*min:0.00, max:1000.00Charge amount in USD.
testbooleanNo-Mark as a test charge. Defaults to false. Required for non-approved apps and development stores.

* Required unless plan_handle is given.

Request

json
{
  "name": "Premium Features Unlock",
  "return_url": "https://myapp.com/billing/success",
  "price": {
    "amount": 29.99
  },
  "test": false
}

Response

json
[201]
{
  "type": "onetime",
  "id": "aoch_01234567890abcdef",
  "store_id": "...",
  "name": "Premium Features Unlock",
  "status": "pending",
  "plan_id": null,
  "price": {
    "amount": "29.99",
    "currency": "USD"
  },
  "test": false,
  "confirmation_url": "https://..."
}

Redirect the seller to confirmation_url immediately after receiving this response.

TIP

The charge remains in pending status until the seller approves or declines it. Verify the final status via List charges after the seller is redirected back to your return_url.

AppOnetimeCharge object

FieldTypeDescription
typestringAlways "onetime" for one-time charges.
idstringUnique charge identifier, prefixed with aoch_.
store_idstringID of the store this charge belongs to.
namestringName of the charge as provided in the request.
statusstringCurrent charge status. See charge statuses.
priceobjectPrice information object.
price.amountstringCharge amount as a decimal string (e.g. "29.99").
price.currencystringCurrency code. Always "USD".
testbooleanWhether this is a test charge.
confirmation_urlstringURL for the seller to approve or decline the charge. Only present when status is pending.