Create a Charge
POST
/charges
const url = 'http://pay.caspeco.net/charges';const options = { method: 'POST', headers: { Location: 'http://pay.caspeco.net/v1/charges/', Host: 'pay.caspeco.net', Date: 'Tue, 15 Nov 2014 08:12:31 GMT', Digest: 'SHA-256=7oaYBB1oQVPy1BvP2ndYtxdD5EWNynt9lxCHzOdXb1A=', 'Content-Type': 'application/json' }, body: '{"Amount":10000,"AmountVat":2500,"Customer":"9d211740","Currency":"SEK","Order":"ABC123","OrderDescription":"Test Purchase","Merchant":1234,"ReturnUrl":"https://www.example-shop.com/payment-done","ReplaceCard":true,"ProcessAggregatedPayment":false,"Capture":true,"PersonalIdentityNumber":"9000000000","AuthenticationToken":"25fd41b0-8694-4046-9e6d-360065eabfb0","Type":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://pay.caspeco.net/charges \ --header 'Content-Type: application/json' \ --header 'Date: Tue, 15 Nov 2014 08:12:31 GMT' \ --header 'Digest: SHA-256=7oaYBB1oQVPy1BvP2ndYtxdD5EWNynt9lxCHzOdXb1A=' \ --header 'Host: pay.caspeco.net' \ --header 'Location: http://pay.caspeco.net/v1/charges/' \ --data '{ "Amount": 10000, "AmountVat": 2500, "Customer": "9d211740", "Currency": "SEK", "Order": "ABC123", "OrderDescription": "Test Purchase", "Merchant": 1234, "ReturnUrl": "https://www.example-shop.com/payment-done", "ReplaceCard": true, "ProcessAggregatedPayment": false, "Capture": true, "PersonalIdentityNumber": "9000000000", "AuthenticationToken": "25fd41b0-8694-4046-9e6d-360065eabfb0", "Type": 1 }'Create a new charge from a customer to a recipient merchant.
Note: If the Capture parameter is not set to true, the customer’s card won’t actually be charged until a Capture is posted for this charge.
Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Location
Host
string
E.g. pay.caspeco.net
Example
pay.caspeco.netDate
string
E.g. Tue, 15 Nov 2014 08:12:31 GMT
Example
Tue, 15 Nov 2014 08:12:31 GMTDigest
string
E.g. SHA-256=7oaYBB1oQVPy1BvP2ndYtxdD5EWNynt9lxCHzOdXb1A=
Example
SHA-256=7oaYBB1oQVPy1BvP2ndYtxdD5EWNynt9lxCHzOdXb1A=Request Body
Section titled “Request Body”Media typeapplication/json
object
Amount
number
AmountVat
number
Customer
string
Currency
string
Order
string
OrderDescription
string
Merchant
number
ReturnUrl
string
ReplaceCard
boolean
ProcessAggregatedPayment
boolean
Capture
boolean
PersonalIdentityNumber
string
AuthenticationToken
string
Type
number
Example
{ "Amount": 10000, "AmountVat": 2500, "Customer": "9d211740", "Currency": "SEK", "Order": "ABC123", "OrderDescription": "Test Purchase", "Merchant": 1234, "ReturnUrl": "https://www.example-shop.com/payment-done", "ReplaceCard": true, "ProcessAggregatedPayment": false, "Capture": true, "PersonalIdentityNumber": "9000000000", "AuthenticationToken": "25fd41b0-8694-4046-9e6d-360065eabfb0", "Type": 1}Responses
Section titled “Responses”Created
Media typeapplication/json
object
Id
string
Amount
number
AmountVat
number
Captured
boolean
Refunded
boolean
Customer
string
Currency
string
Order
string
OrderDescription
string
Merchant
number
ReturnUrl
string
MaskedCardNumber
string
PaymentMethod
string
Status
number
AuthenticationToken
string
Error
string
HasError
boolean
VerificationNeeded
boolean
VerificationUrl
boolean
CustomerHasCard
boolean
TerminalUrl
string
PersonalIdentityNumber
string
Examples
Exampleresponse
{ "Id": "aaa111", "Amount": 10000, "AmountVat": 2500, "Captured": false, "Refunded": false, "Customer": "9d211740", "Currency": "SEK", "Order": "ABC123", "OrderDescription": "Test Purchase", "Merchant": 1234, "ReturnUrl": "https://www.example-shop.com/payment-done", "MaskedCardNumber": "5413******1000", "PaymentMethod": "card", "Status": 1, "AuthenticationToken": "25fd41b0-8694-4046-9e6d-360065eabfb0", "Error": "", "HasError": "false", "VerificationNeeded": true, "VerificationUrl": "https://pay.caspeco.se/Charge/aaa111/Verify", "CustomerHasCard": true, "TerminalUrl": "https://epayments.nets.eu", "PersonalIdentityNumber": "9000000000"}