post https://api.chartmogul.com/v1/import/invoices//transactions
Creates a transaction
object for an invoice imported using the Import API.
Examples
curl -X POST "https://api.chartmogul.com/v1/import/invoices/inv_565c73b2-85b9-49c9-a25e-2b7df6a677c9/transactions" \
-u YOUR_API_KEY: \
-H "Content-Type: application/json" \
-d '{
"type": "refund",
"date": "2022-12-25 18:10:00",
"result": "successful"
}'
customer = ChartMogul::Customer.all(external_id: "cus_0001").first
transaction = ChartMogul::Transactions::Refund.create!(
invoice_uuid: "inv_565c73b2-85b9-49c9-a25e-2b7df6a677c9",
date: Time.utc(2022, 12, 25, 18, 10),
result: "successful",
)
ChartMogul.Transaction.create(
config,
"inv_565c73b2-85b9-49c9-a25e-2b7df6a677c9",
{
type: "refund",
date: "2022-12-25 18:10:00",
result: "successful",
}
);
ChartMogul\Transactions\Refund::create([
"invoice_uuid" => "inv_565c73b2-85b9-49c9-a25e-2b7df6a677c9",
"date" => "2022-12-25 18:10:00",
"result" => "successful"
]);
api.CreateTransaction(&cm.Transaction{
Type: "refund",
Date: "2022-12-25 18:10:00",
Result: "successful",
}, "inv_565c73b2-85b9-49c9-a25e-2b7df6a677c9")
chartmogul.Transaction.create(
config,
uuid="inv_565c73b2-85b9-49c9-a25e-2b7df6a677c9",
data={"type": "refund", "date": "2022-12-25 18:10:00", "result": "successful"},
)
Result Format
{
"uuid": "tr_325e460a-1bec-41bb-986e-665e38a1e4cd",
"external_id": null,
"type": "refund",
"date": "2022-12-25T18:10:00.000Z",
"result": "successful"
}
#<ChartMogul::Transactions::Refund:0x007fb499222a40
@uuid="tr_325e460a-1bec-41bb-986e-665e38a1e4cd",
@external_id=nil,
@type="refund",
@date=2022-12-25 18:10:00 UTC,
@result="successful"
>
{
uuid: "tr_325e460a-1bec-41bb-986e-665e38a1e4cd",
external_id: null,
type: "refund",
date: "2022-12-25T18:10:00.000Z",
result: "successful"
}
ChartMogul\Transactions\Refund::__set_state(array(
"type" => "refund",
"uuid" => "tr_325e460a-1bec-41bb-986e-665e38a1e4cd",
"date" => "2022-12-25T18:10:00.000Z",
"result" => "successful",
"external_id" => NULL
));
(*chartmogul.Transaction)(0xc04201a600)({
UUID: (string) (len=39) "tr_325e460a-1bec-41bb-986e-665e38a1e4cd",
Date: (string) (len=24) "2022-12-25T18:10:00.000Z",
ExternalID: (string) "",
Result: (string) (len=10) "successful",
Type: (string) (len=6) "refund",
Errors: (chartmogul.Errors) chartmogul: map[]
})
<Transaction{
date=datetime.datetime(2022, 12, 25, 18, 10),
external_id=None,
result="successful",
type="refund",
uuid="tr_325e460a-1bec-41bb-986e-665e38a1e4cd"
}>
In the response, the JSON
object contains the following data:
uuid
- The UUID of thetransaction
object generated by ChartMogul.external_id
- The unique external identifier for this transaction, as specified by you.type
- One ofpayment
orrefund
, as specified by you.date
- The timestamp of when the transaction was attempted, as specified by you.result
- The result of the transaction attempt. One ofsuccessful
orfailed
, as specified by you.amount_in_cents
- The amount partially paid/refunded for this transaction.