Approve a Purchase Order

order.approval.pending

FastSpring sends the order.approval.pending webhook after a customer completes a purchase order (PO) which requires your approval. This applies when you enable FastSpring's Invoicing Service and require approval for POs.

When Webhook Expansion is enabled, order.approval.pending includes the full customer account object. If it is not enabled, the webhook only returns the account ID.

Contents of Event Payload

NameTypeDescription
orderstringInternal order ID.
idstringInternal order ID.
referencestringCustomer-facing order reference.
buyerReferencestringPurchase order number.
ipAddressnumberIP address of the customer.
completedbooleanFalse for order.approval.pending.
changedintegerDate in which the order instance was updated, in milliseconds.
changedValueintegerDate in which the order instance was updated, in milliseconds.(backward compatibility)
changedInSecondsintegerDate in which the order instance was updated, in seconds.
changedDisplaystringDate of the most recent update to the order. This is formatted for display based on the language in which the order was processed.
languagestring2 character ISO code of the order language.
live booleanTrue indicates a live order. False indicates a test order.
currencystring3 character ISO code of the order currency.
payoutCurrencystring3 character ISO code for the currency in which your disbursement will be made.
invoiceUrlstringURL of the associated invoice.
accountstring
object
FastSpring-generated customer account ID (expansion disabled)
If you have enabled webhook expansion, see Account for expanded contents.
totalnumberOrder total in the transaction's currency.
totalDisplaystringOrder total, formatted for display in the transaction's currency.
totalInPayoutCurrencynumberOrder total in your disbursement currency.
totalInPayoutCurrencyDisplaystringOrder total, formatted for display in your disbursement currency.
taxnumberTax amount
taxDisplaystringTax amount, formatted for display in the transaction's currency.
taxInPayoutCurrencynumberTax amount in the currency of your FastSpring disbursements.
taxInPayoutCurrencyDisplaystringTax amount, formatted for display in your disbursement currency.
subtotalnumberOrder subtotal in the transaction's currency.
subtotalDisplaystringOrder subtotal, formatted for display in the transaction's currency.
subtotalInPayoutCurrencynumberOrder subtotal in your disbursement currency.
subtotalInPayoutCurrencyDisplaystringOrder subtotal, formatted for display in your disbursement currency.
discountnumberTotal discount applied to the order in the transaction's currency.
discountDisplaystringTotal discount applied to the order. This is formatted to display in the transaction's currency
discountInPayoutCurrencynumberTotal discount applied to the order in your disbursement currency.
discountInPayoutCurrencyDisplaystringTotal discount applied to the order, formatted for display in your disbursement currency.
discountWithTaxnumberDiscount amount including tax.
discountWithTaxDisplaystringDiscount amount including tax. This is formatted for display in the transaction's currency
discountWithTaxInPayoutCurrencynumberDiscount amount including tax in the your disbursement currency.
discountWithTaxInPayoutCurrencyDisplaystringDiscount amount including tax, formatted for display in the your disbursement currency.
billDescriptorstringNot applicable for this webhook.
paymentobjectNot applicable for this webook.
reasonstringReason approval is required for the order.
customerobjectCustomer information.
   firststringCustomer's first name.
   laststringCustomer's last name.
   emailstringCustomer's email address.
   companystringCustomer's company name
   phonestringCustomer's telephone number
addressobjectAddress information associated with the order.
   citystringCity.
   regionCodestringFirst line of the address. This is applicable when you enable Force physical address collection for all orders on your storefront.
   regionDisplaystringSecond line of the address. This is applicable when you enable Force physical address collection for all orders on your storefront.
   regionstringState or region.(backward compatibility)
   postalCodestringPostal code.
   countrystringCountry.
   displaystringString of address information formatted for display.
recipientsarrayCustomer and gift recipient information. This differs from customer and address information on gift purchases.
   recipientobjectRecipient information.
      firststringRecipient's first name.
      laststringRecipient's last name.
      emailstringRecipient's email address.
      companystringRecipient's associated company.
      phonestringRecipient's phone number.
      accountstring
object
Recipient's FastSpring-generated account ID (expansion disabled)
If you have enabled webhook expansion, see Account for expanded contents.
notesarrayInternal order notes. You can enter these from the app.
itemsarrayOne object per product included in the order. For the full array, see Items Contents.
couponsarrayCoupon ID applied to the order.
quotestringInternal ID of the associated quote.

Examples

Webhook Expansion Disabled

{  
   "order":"8FqrTAgJRSKSQI3djH90eQ",
   "id":"8FqrTAgJRSKSQI3djH90eQ",
   "reference":"YES200316-7019-29124",
   "buyerReference":null,
   "ipAddress": "000.000.00.000",
   "completed":false,
   "changed":1548093006664,
   "changedValue":1548093006664,
   "changedInSeconds":1548093006,
   "changedDisplay":"1/21/19",
   "language":"en",
   "live":false,
   "currency":"USD",
   "payoutCurrency":"USD",
   "quote":"QUOT2J52LKCFCHPOYSW6UTRMNZJA"
"invoiceUrl":"https://yourexamplestore.onfastspring.com/account/order/YES200316-7019-29124/invoice",
   "account":"N8FjcSWcQNeYCc-suM1O8g",
   "total":59.99,
   "totalDisplay":"$59.99",
   "totalInPayoutCurrency":59.99,
   "totalInPayoutCurrencyDisplay":"$59.99",
   "tax":0.0,
   "taxDisplay":"$0.00",
   "taxInPayoutCurrency":0.0,
   "taxInPayoutCurrencyDisplay":"$0.00",
   "subtotal":59.99,
   "subtotalDisplay":"$59.99",
   "subtotalInPayoutCurrency":59.99,
   "subtotalInPayoutCurrencyDisplay":"$59.99",
   "discount":0.0,
   "discountDisplay":"$0.00",
   "discountInPayoutCurrency":0.0,
   "discountInPayoutCurrencyDisplay":"$0.00",
   "discountWithTax":0.0,
   "discountWithTaxDisplay":"$0.00",
   "discountWithTaxInPayoutCurrency":0.0,
   "discountWithTaxInPayoutCurrencyDisplay":"$0.00",
   "billDescriptor":"N/A",
   "payment":{  

   },
   "reason":"purchaseOrder",
   "customer":{  
      "first":"Lieutenant",
      "last":"Wharf",
      "email":"[email protected]",
      "company":"United Federation of Places",
      "phone":"8054099008"
   },
   "address":{  
      "addressLine1":"801 Garden Street",
      "city":"Santa Barbara",
      "regionCode":"CA",
      "regionDisplay":"California",
      "region":"California",
      "postalCode":"93101",
      "country":"US",
      "display":"801 Garden Street, Santa Barbara, California, 93101, US"
   },
   "recipients":[  
      {  
         "recipient":{  
            "first":"Lieutenant",
            "last":"Wharf",
            "email":"[email protected]",
            "company":"United Federation of Places",
            "phone":"8054099008",
            "account":"N8FjcSWcQNeYCc-suM1O8g",
            "address":{  
               "addressLine1":"801 Garden Street",
               "city":"Santa Barbara",
               "regionCode":"CA",
               "regionDisplay":"California",
               "region":"California",
               "postalCode":"93101",
               "country":"US",
               "display":"801 Garden Street, Santa Barbara, California, 93101, US"
            }
         }
      }
   ],
   "notes":[  

   ],
   "items":[  
      {  
         "product":"example-product-1",
         "quantity":1,
         "display":"Example Product 1",
         "sku":"skuex1",
         "subtotal":59.99,
         "subtotalDisplay":"$59.99",
         "subtotalInPayoutCurrency":59.99,
         "subtotalInPayoutCurrencyDisplay":"$59.99",
         "attributes":{  
            "season":"of the forge"
         },
         "discount":0.0,
         "discountDisplay":"$0.00",
         "discountInPayoutCurrency":0.0,
         "discountInPayoutCurrencyDisplay":"$0.00",
         "fulfillments":{  
            "instructions":"Thank you for purchasing Example Product 1. To register, please launch the trial version and select Help | Register Example Product 1. Then, copy and paste the license key above into the License Key field and click Submit."
         }
      }
   ]
}

Webhook Expansion Enabled

{
  "order":"-wgJI5wrQVq2a8V2Z8vpyA",
  "id":"-wgJI5wrQVq2a8V2Z8vpyA",
  "reference":null,
  "buyerReference":null,
  "ipAddress": "000.000.00.000",
  "completed":false,
  "changed":1584726571703,
  "changedValue":1584726571703,
  "changedInSeconds":1584726571,
  "changedDisplay":"3/20/20",
  "language":"en",
  "live":true,
  "currency":"USD",
  "payoutCurrency":"USD",
  "quote":"QUOT2J52LKCFCHPOYSW6UTRMNZJA
"invoiceUrl":"https://yourexamplestore.onfastspring.com/account/order/null/invoice",
  "account":{
    "id":"gB_slATyQBqSpAxA7-1YAg",
    "account":"gB_slATyQBqSpAxA7-1YAg",
    "contact":{
      "first":"Leeroy",
      "last":"Jenkins",
      "email":"[email protected]",
      "company":"Chicken Danger, Inc.",
      "phone":"8054099008"
    },
    "language":"en",
    "country":"US",
    "lookup":{
      "global":"VKMqlZ--TIuD44BvXdNkbg"
    },
    "url":"https://yourexamplestore.onfastspring.com/account"
  },
  "total":10.72,
  "totalDisplay":"$10.72",
  "totalInPayoutCurrency":10.72,
  "totalInPayoutCurrencyDisplay":"$10.72",
  "tax":0.72,
  "taxDisplay":"$0.72",
  "taxInPayoutCurrency":0.72,
  "taxInPayoutCurrencyDisplay":"$0.72",
  "subtotal":10.0,
  "subtotalDisplay":"$10.00",
  "subtotalInPayoutCurrency":10.0,
  "subtotalInPayoutCurrencyDisplay":"$10.00",
  "discount":0.0,
  "discountDisplay":"$0.00",
  "discountInPayoutCurrency":0.0,
  "discountInPayoutCurrencyDisplay":"$0.00",
  "discountWithTax":0.0,
  "discountWithTaxDisplay":"$0.00",
  "discountWithTaxInPayoutCurrency":0.0,
  "discountWithTaxInPayoutCurrencyDisplay":"$0.00",
  "billDescriptor":"N/A",
  "payment":{

  },
  "reason":"PAYMENT",
  "customer":{
    "first":"Leeroy",
    "last":"Jenkins",
    "email":"[email protected]",
    "company":null,
    "phone":null
  },
  "address":{
    "city":"Lincoln",
    "regionCode":"NE",
    "regionDisplay":"Nebraska",
    "region":"Nebraska",
    "postalCode":"68512",
    "country":"US",
    "display":"Lincoln, Nebraska, 68512, US"
  },
  "recipients":[
    {
      "recipient":{
        "first":"Leeroy",
        "last":"Jenkins",
        "email":"[email protected]",
        "company":null,
        "phone":null,
        "account":{
          "id":"gB_slATyQBqSpAxA7-1YAg",
          "account":"gB_slATyQBqSpAxA7-1YAg",
          "contact":{
            "first":"Leeroy",
            "last":"Jenkins",
            "email":"[email protected]",
            "company":"Chicken Danger, Inc.",
            "phone":"8054099008"
          },
          "language":"en",
          "country":"US",
          "lookup":{
            "global":"VKMqlZ--TIuD44BvXdNkbg"
          },
          "url":"https://yourexamplestore.onfastspring.com/account"
        },
        "address":{
          "city":"Lincoln",
          "regionCode":"NE",
          "regionDisplay":"Nebraska",
          "region":"Nebraska",
          "postalCode":"68512",
          "country":"US",
          "display":"Lincoln, Nebraska, 68512, US"
        }
      }
    }
  ],
  "notes":[

  ],
  "items":[
    {
      "product":"example-product-1",
      "quantity":1,
      "display":"Example Product 1",
      "sku":"skuex1",
      "subtotal":10.0,
      "subtotalDisplay":"$10.00",
      "subtotalInPayoutCurrency":10.0,
      "subtotalInPayoutCurrencyDisplay":"$10.00",
      "attributes":{
        "conditions":"{exclude:{countries:['AT','GB']}}"
      },
      "discount":0.0,
      "discountDisplay":"$0.00",
      "discountInPayoutCurrency":0.0,
      "discountInPayoutCurrencyDisplay":"$0.00",
      "driver":{
        "type":"cross-sell",
        "path":"yourexamplestore"
      }
    }
  ]
}