The GravityCoin Payment Gateway API is designed for merchants that need full control over their customers’ shopping and checkout experience. An e-commerce site can make use of this API to transmit invoice information to Gravity Pay from their backend server, and receive server notifications when the customer has completed payment and the invoice total has been credited to the merchant account.
A merchant can elect to receive notifications immediately upon receipt of a payment, or when the payment has been completed and credited to the merchant account.
The following interactions with the Gravity Pay service available via this API:
- Create an invoice
- Fetch an invoice status
- Receive invoice status updates
- GravityCoin Best Bid exchange rates
- Retrieve your merchant account ledger
Activate API Access (api version 1)
The Gravity Pay JSON API is accessible for authorized merchant. The merchant must obtain an API key from the Gravity Pay account by logging into their merchant account and clicking on Payment. A merchant can create keys for use with different ecommerce stores. Once an API key has been created, Gravity Pay will use this API key to authenticate your API connections. The merchant’s API key must remain private and should never be visible on any client facing code. Should it ever be compromised, the merchant can generate a new key in their Gravity Pay account. When connecting to Gravity Pay, use HTTP Basic Authentication with the username as your API key and password. You should communicate with the server if you can validate the Gravity Pay SSL certificate with a certificate authority. Most HTTPS client libraries make this as simple as setting a switch. Taking both of these steps will ensure that you are always communicating with the Gravity Pay server and that your API key will never be exposed.
GravityCoin Payment Protocol
The Gravity Pay server fully supports the GravityCoin Payment Protocol. See the specifications for this implementation:
- Payment Protocol MIME Types
- URI Extensions for Payment Protocol
- Header for response type negotiation with Request URLs
The GravityCoin Payment Protocol eliminates a lot of human error in making a GravityCoin payment. A user can just click on a payment link, or scan a QR code, and the wallet software offers two simple choices to the user, pay or don’t pay. The user no longer has to copy the address and amount into their wallet.
Native Refund Address Support
With the Payment Protocol, the wallet supplies a refund address along with the payment. This eliminates another potential source of error in refund situations. This approach to refunds works on the block chain, with any wallet software, and does not require the buyers to have a Gravity Pay account.
Secure, Signed Payment Requests
The payment protocol supports optional SSL signatures on payment requests. This offers certainty to users that they are sending their payment to the intended recipient. When using a wallet that supports the payment protocol, you will immediately notice that your wallet tells you that Gravity Pay is requesting a payment.
User Friendly QR Codes
Gravity Pay also supports QR codes for GravityCoin payments. It reduces the information required to be embedded in a payment request QR code, reducing their density. Less dense QR codes are easier to use in low light situations or from longer distances. These lower density QR codes are also normal HTTP URLs, offering an opportunity to provide additional information and instructions to users of devices that don’t already have a wallet installed. Gravity Pay displays both the older, backward compatible QR code as well as the newer payment protocol QR code. You can toggle between these two QR codes by clicking or tapping on the QR code in our current invoice.
Direct Payment Communication
Perhaps the most exciting thing about the payment protocol is that it eliminates the need to use the mesh network for communicating a payment from sender to recipient. The GravityCoin mesh network currently serves two purposes: communicating payments from sender to recipient and communicating payments from originator to miners. By communicating payments directly from sender to recipient, the mesh network can be used exclusively for communicating payments from originator to miners. The network is then free to propagate or ignore transactions without adversely affecting the communications between sender and recipient. This allows for the emergence of a true market in transaction fees.