To simplify acceptance of digital assets you can use Payment SmartApp. Payment SmartApp will orchestrate automatic forwarding of deposit to related Virtual account.
Amount received to Virtual account will be diminished for the amount of blockchain fee paid for automatic withdrawal from Deposit account to Ramp account.
Create Payment
Use seal
object to store immutable data about the payment.
Use data
object to store variable data about the payment.
Source Deposit account is automatically created.
Target Virtual account must have related Ramp account assigned.
To create Payment you must provide target Virtual account address or alias.
Provide expected amount
of deposit transaction to be able to track if it is paid in full.
cURL
Copy echo 'Create payment request for 0.03 BTC'
curl --location --request POST 'https://api.orangepill.cloud/v1/apps/deposit/payment' \
--header 'x-api-key: AXVubzpwQDU1dzByYM==' \
--header 'idempotency-key: 27373fabc392933dffabb' \
--header 'Content-Type: application/json' \
--data-raw '{
"destination": {
"account": "6340be52dffbdb56217f6a7b"
},
"amount": 0.03,
"asset": "BTC",
"original_amount": 120.40,
"original_currency": "USD",
"valid_until": 1671242779881,
"external": "INV12345",
"seal": {
"my_signature_field": "my_signature_value"
},
"data": {
"description": "Payment 0.03 BTC",
"invoice": "INV12345"
}
}'
In response we get new payment
with status PENDING
if validation was succeful. Notice that Deposit account is automatically created for source
.
Copy {
"id" : "639d2416cd7325b35f409452" ,
"source" : {
"account" : "634b56217f6a7b0be52dffbd" ,
"deposit_address" : "bc1q7pna7w7462uruh8m54tcnzspva8xd98wmc546u" ,
"owner" : "639675ab191e9023f356dfa6"
} ,
"destination" : {
"account" : "6340be52dffbdb56217f6a7b" ,
"owner" : "639675ab191e9023f356dfa6"
} ,
"amount" : "0.03" ,
"asset" : "ETH" ,
"original_amount" : 120.40 ,
"original_currency" : "USD" ,
"valid_until" : 1671242779881 ,
"external" : "INV12345" ,
"seal" : {
"my_signature_field" : "my_signature_value"
} ,
"data" : {
"description" : "Payment 0.03 BTC" ,
"invoice" : "INV12345"
} ,
"owner" : "639675ab191e9023f356dfa6" ,
"created_at" : 1671242774572 ,
"status" : "PENDING" ,
"error" : null
}
Payment status
Deposit received, withdrawal and forwarding in process.
Payment processing was successful.
Payment is on time but amount received is not full.
Payment is on time but amount received is overpaid.
Payment was received in full but after valid time.
Payment creation or processing has failed.
Payment is ready for refund to source.
Payment has been refunded to source payer.
List payments
You can apply filters to get list of payments.
cURL
Copy echo 'list payments with status PENDING'
curl --location --request GET 'https://api.orangepill.cloud/v1/apps/deposit/payment?query={"status":"PENDING"}' \
--header 'x-api-key: AXVubzpwQDU1dzByYM==' \
--header 'Content-Type: application/json'
In response we get array of payment
objects.
Copy [{
"id" : "639d2416cd7325b35f409452" ,
"source" : {
"account" : "634b56217f6a7b0be52dffbd" ,
"deposit_address" : "bc1q7pna7w7462uruh8m54tcnzspva8xd98wmc546u" ,
"owner" : "639675ab191e9023f356dfa6"
} ,
"destination" : {
"account" : "6340be52dffbdb56217f6a7b" ,
"owner" : "639675ab191e9023f356dfa6"
} ,
"amount" : "0.03" ,
"asset" : "BTC" ,
"original_amount" : 120.40 ,
"original_currency" : "USD" ,
"valid_until" : 1671242779881 ,
"external" : "INV12345" ,
"seal" : {
"my_signature_field" : "my_signature_value"
} ,
"data" : {
"description" : "Payment 0.03 Bitcoin" ,
"invoice" : "INV12345"
} ,
"owner" : "639675ab191e9023f356dfa6" ,
"created_at" : 1671242774572 ,
"status" : "PENDING" ,
"error" : null
}]