Create an invoice
POST
https://us-central1-appgregator.cloudfunctions.net/stripe/invoices/
Query Parameters
Name
Type
Description
name*
String
ft-4
connection_name*
String
stripe-1
Headers
Name
Type
Description
x-api-key*
String
XXX
Request Body
Name
Type
Description
customer*
String
cus_MQqeLuPp19Qbk8
{
"id": "in_1MZX60Iyq0PiFIhUHls7HxJ4",
"object": "invoice",
"account_country": "US",
"account_name": "Appgregator",
"account_tax_ids": null,
"amount_due": 2000,
"amount_paid": 0,
"amount_remaining": 2000,
"amount_shipping": 0,
"application": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": false,
"auto_advance": false,
"automatic_tax": {
"enabled": false,
"status": null
},
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1675937476,
"currency": "usd",
"custom_fields": null,
"customer": "cus_MQqeLuPp19Qbk8",
"customer_address": null,
"customer_email": "account@accdemo.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": null,
"discount": null,
"discounts": [],
"due_date": null,
"ending_balance": null,
"footer": null,
"from_invoice": null,
"hosted_invoice_url": null,
"invoice_pdf": null,
"last_finalization_error": null,
"latest_revision": null,
"lines": {
"object": "list",
"data": [
{
"id": "il_1MZX5tIyq0PiFIhU7aNa2IRk",
"object": "line_item",
"amount": 2000,
"amount_excluding_tax": 2000,
"currency": "usd",
"description": null,
"discount_amounts": [],
"discountable": true,
"discounts": [],
"invoice_item": "ii_1MZX5tIyq0PiFIhUOK0qo2dl",
"livemode": false,
"metadata": {},
"period": {
"end": 1675937469,
"start": 1675937469
},
"plan": null,
"price": {
"id": "price_1MZX5tIyq0PiFIhUrMFpU69m",
"object": "price",
"active": false,
"billing_scheme": "per_unit",
"created": 1675937469,
"currency": "usd",
"custom_unit_amount": null,
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"product": "prod_NKBSkWUk0npqzT",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
"unit_amount": 2000,
"unit_amount_decimal": "2000"
},
"proration": false,
"proration_details": {
"credited_items": null
},
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem",
"unit_amount_excluding_tax": "2000"
}
],
"has_more": false,
"total_count": 1,
"url": "/v1/invoices/in_1MZX60Iyq0PiFIhUHls7HxJ4/lines"
},
"livemode": false,
"metadata": {},
"next_payment_attempt": null,
"number": null,
"on_behalf_of": null,
"paid": false,
"paid_out_of_band": false,
"payment_intent": null,
"payment_settings": {
"default_mandate": null,
"payment_method_options": null,
"payment_method_types": null
},
"period_end": 1675937476,
"period_start": 1675937476,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"quote": null,
"receipt_number": null,
"rendering_options": null,
"shipping_cost": null,
"shipping_details": null,
"starting_balance": 0,
"statement_descriptor": null,
"status": "draft",
"status_transitions": {
"finalized_at": null,
"marked_uncollectible_at": null,
"paid_at": null,
"voided_at": null
},
"subscription": null,
"subtotal": 2000,
"subtotal_excluding_tax": 2000,
"tax": null,
"test_clock": null,
"total": 2000,
"total_discount_amounts": [],
"total_excluding_tax": 2000,
"total_tax_amounts": [],
"transfer_data": null,
"webhooks_delivered_at": null
}
curl --location --request POST 'https://us-central1-appgregator.cloudfunctions.net/stripe/invoices?name=ft-4&connection_name=stripe-1' \
--header 'x-api-key: XXX' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'customer=cus_MQqeLuPp19Qbk8'
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
'customer': 'cus_MQqeLuPp19Qbk8'
});
var config = {
method: 'post',
url: 'https://us-central1-appgregator.cloudfunctions.net/stripe/invoices?name=ft-4&connection_name=stripe-1',
headers: {
'x-api-key': 'XXX',
'Content-Type': 'application/x-www-form-urlencoded'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://us-central1-appgregator.cloudfunctions.net/stripe/invoices?name=ft-4&connection_name=stripe-1',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => 'customer=cus_MQqeLuPp19Qbk8',
CURLOPT_HTTPHEADER => array(
'x-api-key: XXX',
'Content-Type: application/x-www-form-urlencoded'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Last updated