New API – PayPal Digital Goods

Selling Digital Goods through PayPal with cloudbase.ioToday we have released a new API which allows you to use your PayPal account for the sale of digital goods through your mobile application.

For the new APIs to work you will have to setup a PayPal account, enable API access to it and enter your PayPal API credentials in your application settings, under the other APIs section. By default your PayPal account is not enabled to the sale of digital goods. You will have to ask PayPal to enable the service.

At the moment the PayPal API supports the sale of digital goods. We are building the ability to initiate subscriptions – recurring payments – through a mobile application.

A PayPal transaction with can be divided in two steps:

1. Prepare a transaction

Using the CBPayPalBill and CBPayPalBillItem objects the information about the transaction are sent to – At this point the transaction is initiated with PayPal and a transaction token is generated. This token and checkout URL are then returned to the application. By default, once the transaction is complete, PayPal will redirect the browser to the API URL. This will be trapped by the helper class as per the example in step 2. It is possible to specify custom transaction completed or cancelled URLs in the CBPayPalBill object. If you are using these fields then you will have to handle the completion of the transaction on your website – you can skip step 2 and go straight to step 3, closing the transaction with

2. Monitor and complete a transaction

Once the checkout URL is returned you can start a browser window and let PayPal go through the transaction with your user. The helper classes have methods to monitor the transaction using the mobile OS callbacks.

For Android this is slightly different…

The PayPal APIs at the moment are supported in the iOS, Android and Windows Phone helper classes.

If you are not using one of the helper classes then you can call the update-status APIs to complete the transaction once you have received the confirmation from PayPal.