Skip to content

Instantly share code, notes, and snippets.

@rakibulislam
Created February 13, 2018 19:09
Show Gist options
  • Save rakibulislam/1c37b278b64cec771b3df1348a13339b to your computer and use it in GitHub Desktop.
Save rakibulislam/1c37b278b64cec771b3df1348a13339b to your computer and use it in GitHub Desktop.
CURRENT_DATE=`date -Ru | sed 's/+0000/GMT/'`
CHECKSUM=$(echo -n "application/json,,/bills/<ID>/pay,$CURRENT_DATE" \
| openssl dgst -sha1 -binary -hmac "your-secret-key" \
| base64)
curl "https://apix.casiregalii.com/bills/<ID>/pay" \
-X POST \
-d '{"amount":5568.00, "currency":"USD"}' \
-H "Accept: application/vnd.regalii.v3.2+json" \
-H "Content-Type: application/json" \
-H "Content-MD5:" \
-H "Date: $CURRENT_DATE" \
-H "Authorization: APIAuth your-api-key:$CHECKSUM"
# => JSON Response
{
"type": "transaction",
"id": 59335549,
"amount": 5568.00,
"amount_currency": "USD",
"fx_rate": 18.2569,
"amount_usd": 304.98,
"transaction_fee": 3.0,
"total_usd": 307.98,
"hours_to_fulfill": 48,
"status": "fulfilled"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment