In-App Purchases (IAP) allow you to build customized purchase experiences for your apps. Using our dead-simple JavaScript API you can ask the user to make purchases dynamically based on your own requirements.
Adding In-App Products
To enable IAPs in your app, first, you need to define at least one In-App Product for your app,
- Go to your Developer Dashboard.
- Choose the app you would like to enable In-App Purchases for.
- From the dashboard page for the selected app, choose In-App Products.
- Select New Product and enter your product's Name, SKU, and Price. Then select Add Product.
In-App Purchases in your app
-
Add the Outpan JS library to the
<head>
element of your HTML:<script type="text/javascript" src="https://js.outpan.com/v1/"></script>
-
At the desired point in your application, call the
OPRequestPayment
function to ask for payment from the user:OPRequestPayment('SKU-0001', function(resp){ if(resp.success) alert('Payment succeeded.'); else alert('Payment failed.'); });