Create a charge
Arguments
source
string
true
Voucher secret PIN
payer[id]
string
true
The customer’s id in your website.
payer[firstname]
string
false
The customer’s firstname.
payer[lastname]
string
false
The customer’s lastname.
payer[email]
string
false
The customer’s email.
payer[phone]
string
false
The customer’s phone number.
payer[address_city]
string
false
The customer’s city.
payer[address_country]
string
false
The customer’s country (Two-letter ISO code representing the country).
payer[address_line1]
string
false
The customer’s address line1.
payer[address_line2]
string
false
The customer’s address line2.
payer[address_state]
string
false
The customer’s state.
payer[address_zip]
string
false
The customer’s zip.
payer[ip]
string
false
The customer’s ip address.
amount
integer
false
A positive integer representing how much to charge in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency.
currency
string
false
Three-letter ISO currency code (ISO-4217). Must be a sent if amount is present.
metadata
hash
false
A set of key-value pairs that you can attach to a charge object. It can be useful for storing additional information about the charge in a structured format.
POST
https://{domain given}/v2/charges
curl https://{domain given}/v2/charges \
-u sk_test_BQokikJOvBiI2HlWgH4olfQ2: \
-d source=KLVGBEFEBPZ7B4QW
-d payer[ip]=127.0.0.1 \
-d payer[id]=123 \
-d payer[firstname]=John \
-d payer[lastname]=Doe \
-d payer[email][email protected] \
-d payer[address_city]="Mannheim Neckarstadt" \
-d payer[address_country]=DE \
-d payer[address_line1]="Scharnweberstrasse 24" \
-d payer[address_line2]= \
-d payer[address_state]=BW \
-d payer[address_zip]=68-167 \
-d payer[phone]=+49062111272935 \
-x POST
The above command returns JSON structured like this:
{
"id": "AWT_fCCMh9GTrU2CKeaeXw==",
"amount": 1000,
"currency": "USD",
"payer": {
"id": "123",
"firstname": "John",
"lastname": "Doe",
"email": "[email protected]",
"ip": "127.0.0.1",
"address_city": "Mannheim Neckarstadt",
"address_country": "DE",
"address_line1": "Scharnweberstrasse 24",
"address_line2": "",
"address_zip": "68167",
"address_state": "BW",
"phone": "+49062111272935"
},
"source": "01CKZQR849A9MM529MF5HCG8RN",
"status": "succeeded",
"livemode": false
}
Last updated