This call allows your app to ask the user for a one time payment. Users must have a paid account to run paid apps. Payments will processed at the end of the month. When you request a payment, the user will see a request.


const amountInDollars = 0; // amount in USD
const paymentFor = ''; // payment description
dronedeployApi.Payments.charge(amountInDollars, paymentFor);

Example Call

dronedeployApi.Payments.charge(4.00, 'Testing Payments')
    function(success){ console.log('paymentId:', success) },
    function(error){ console.log(error) }

Note: If your app is not published, the returned paymentId is fake and is not saved to our database. Additionally, having a paid account is not enforced while in development.

Example Response

Success Response

If the payment is successful you will receive the payment id.

.then(function(paymentId){ console.log(paymentId) })
// 298348de72987ac

Error Responses

If the user clicks cancel on the payment request.

  function(error){ console.log(error) },
// Error('User declined payment request.')

If the user does not have a paid account.

  function(error){ console.log(error) },
// Error('User does not have a paid account.')

If the request fails (I.E. the user is offline).

  function(error){ console.log(error) },
// Error('Error Submitting Payment')

Full Example

Payment FAQ

How to validate or cancel a payment?

  1. From the account that authored the plugin, get your API key here

  2. Send a GET request to this endpoint with your payment_id, /v1/plugin_payments/<payment_id>

    1. Example Request

      1. curl ""
        Example Response
    2. Example Response

      1. {
            "user_id": "57c5fc90dd32274105595f92", 
            "description": "Paid for something", 
            "date_creation": 1234567890100, 
            "date_paid": null, 
            "amount": 1000, 
            "plugin_id": "5817d4b6361143b45cbb072a", 
            "id": "5817d4b9361143b45cbb072b"
  3. To cancel a payment send a PUT request to /v1/plugin_payments/<payment_id> with {"status": "cancelled"} as the body.

    1. curl -X PUT -H "Content-Type: application/json" -d '{"status":"cancelled"}' ""

Read more about our REST API.

Last updated