App Payment Notification API
Per the Weebly App Developer Agreement, you must report all revenue received from the sales of your app. Use the Payment Notifications API to report app revenue or refunds as they occur. See Report Revenue for details on what you need to report and when, and how to correct any reporting errors.
You need to create the code that handles the actual transactions with your customers and then use this API to report those transactions to us.
You need to create the code that handles the actual transactions with your customers and then use this API to report those transactions to us.
Tip: Weebly doesn't handle payment processing from your customers. You'll need to implement that in your app. Typically, the flow looks like this:
- The site owner downloads and installs your app.
- You use your OAuth redirect to send the user to a page on your site where they can pay for the app.
- You process transaction with a service of your choice.
- You report revenue/refunds from each transaction to us via our Payment API.
Before your app can be accepted into the App Center, you need to create test purchases and test refunds. See examples at the end of this topic. You can review your posted payment notifications using the Payment Log.
Note: To authenticate with the Weebly API, you need to use OAuth. This will allow you to access resources based on a particular user and site.
In this topic:
Fields
The following table shows all the fields that exist for this API, including those that are required when reporting.
Name |
Description |
Type |
Reqd |
name |
A short description of the transaction |
string |
X |
method |
Type of transaction. Valid values are:
|
string |
X |
kind |
A short string that describes the type of purchase or refund transaction. Suggested values:
|
string |
|
term |
A short string that describes the time period for the kind of transaction. Suggested values:
|
string |
|
gross_amount |
The gross amount paid by the end user. Use negative values for refunds/credits. |
decimal |
X |
payable_amount |
The payment amount owed to Weebly. OK to use a negative value, when needed. |
decimal |
X |
currency |
Currency used for the transaction. Defaults to USD. |
string |
|
detail |
Long description of transaction |
string |
|
notification_id |
Returned only. The unique ID (to this site and app) for this payment notification |
string |
|
parent_notification_id |
A payment notification that is a parent to this one. Notifications have a parent when you use the the Payment Log to correct a notification. The original is deleted and the corrected notification becomes a child to the original. |
string |
|
created_date |
Date the payment notification was created |
Unix timestamp in GMT |
|
updated_date |
Date the payment notification was last updated |
Unix timestamp in GMT |
Create a Payment Notification
Endpoint URL
Creates a new payment notification for an app. The app and site ID are known through the OAuth token.
Scope: no scope required
Scope: no scope required
POST body:
These fields can be created.
Name |
Description |
Type |
Notes |
name |
A short description of the transaction |
string |
Required |
method |
Type of transaction. Valid values are:
|
string |
Required |
kind |
A short string that describes the type of purchase or refund transaction. Suggested values:
|
string |
|
term |
A short string that describes the time period for the kind of transaction. Suggested values:
|
string |
|
gross_amount |
The gross amount paid by the end user. Use negative values for refunds/credits. |
decimal |
Required |
payable_amount |
The payment amount owed to Weebly. OK to use a negative value, when needed. |
decimal |
Required |
currency |
Currency used for the transaction. Defaults to USD. |
string |
|
detail |
Long description of transaction |
string |
Request
Example request
Response
Example response
More Examples
Here's an example POST for a refund. Note that the amounts use negative numbers:
Example refund request
Let's look at a more complicated payment. Say your app charges a monthly subscription fee of $10.00, but then also charges a "per click" fee of .05. The monthly subscription fee is always the same, but the click fee varies each month. For this, your would post two different transactions per customer each month, like this:
And...
And here's an example of a test payment notification
Test payment notification request
Related Topics:
Use the REST API
Use the REST API