Wildfire APIs
Syncing Commission Data via API and Callbacks
14min
once your users start generating sales, you'll want your system to sync the associated data so that you can show these sales to your users, send push notifications, etc there are two ways to get this commission data pull them from our api or receive callbacks from our system in most cases, you'll want to receive callbacks to keep your system in sync as closely as possible, but you'll also want to hit the api to pull batches of commission in case a callback wasn't successful at this time, we do not re attempt failed callbacks commission data via the wildfire api to see the api docs for how to fetch commission data en masse see the api reference https //documenter getpostman com/view/24961/rwgqvyv2#5cc69c1d fb39 4231 894e 7acf25487c6f features of commission api fetch up to 2000 records at a time cursor based requests to page through all results request commissions between a date modified range to capture all changes notes commission api should only be called up to 1 time per 5 seconds (more frequent requests will be rejected) whereas callbacks provide low latency commission data, the batch api provides a guarantee of not missing any records (as callbacks are not retried) requests to the commission api can timeout for a number of reasons (network connectivity, unplanned maintenance windows, etc ) the http response code and payload should be evaluated to ensure you received an expected response if an unexpected response was received, consider retrying with an exponential backoff pattern commission data via callbacks callbacks offer nearly realtime updates as commission records are created or changed in the wildfire platform lower latency means showing a user their cashback sooner and giving them confidence that their purchase was tracked to set up your callback url, in your partner admin tool, select the application you want to configure and then select the gear icon here you can enter a callback url (please ensure it's an https endpoint) and a callback key the callback key can be any value the purpose of the callback key is to ensure that the callback is valid (and that a rogue entity is not invoking your callback url with false data) callback body the content of the body is different depending on what version of the apis your application is configured to use by default, we subscribe an application when it is created to the most recent version of our apis wildfire will not auto update your application to a new version of the apis but you may request to have your application(s) upgraded please contact your client success manager to determine your application's current api version and/or to request an upgrade a v3 callback request will have a body similar to this { "id" "96d0a222 c84c 4b6b 8722 8fb8447f9565", "type" "commission", "action" "create", "payload" { "commissionid" 12345, "applicationid" 0, "merchantid" 123456, "deviceid" 19283, "saleamount" { "amount" "321", "currency" "usd" }, "amount" { "amount" "3 211", "currency" "usd" }, "status" "pending", "trackingcode" "012345 6780a bcdef0 12345", "eventdate" "2019 09 12t01 22 33z", "createddate" "2019 09 13t02 22 33 987654z", "modifieddate" "2019 09 13t02 22 33 987654z", "merchantorderid" "397254095", "merchantsku" "465056245" }, "createddate" "2019 09 15t00 11 33 987654z" } a v4 callback request will have a body similar to this { "id" "87f0a400 c84c 4b6b 8722 8fb8447f9565", "type" "commission", "action" "create", "payload" { "commissionid" 775109, "applicationid" 0, "merchantid" 98813, "deviceid" 12345, "saleamount" { "amount" "384 65", "currency" "usd" }, "amounts" \[ { "amount" "2 88475", "currency" "usd", "splitpart" "application" }, { "amount" "5 7695", "currency" "usd", "splitpart" "device" } ], "status" "paid", "trackingcode" "012345 6780a bcdef0 74932", "eventdate" "2022 10 27t23 08 45z", "lockingdate" "2022 10 27t23 08 45z", "createddate" "2022 10 27t23 08 45 898588z", "modifieddate" "2022 10 27t23 13 45 898588z", "merchantorderid" "1234582725", "merchantsku" "sku123nd" } } note both of the above examples include whitespace/indentation for readability, but when generating the hmac check to verify this callback came from wildfire, the callback body must be evaluated without modification (i e it should contain no indentation/whitespace/formatting) example v3 body without whitespace {"id" "96d0a222 c84c 4b6b 8722 8fb8447f9565","type" "commission","action" "create","payload" {"commissionid" 12345,"applicationid" 0,"merchantid" 123456,"deviceid" 19283,"saleamount" {"amount" "321","currency" "usd"},"amount" {"amount" "3 211","currency" "usd"},"status" "pending","trackingcode" "012345 6780a bcdef0 12345","eventdate" "2019 09 12t01 22 33z","createddate" "2019 09 13t02 22 33 987654z","modifieddate" "2019 09 13t02 22 33 987654z","merchantorderid" "397254095","merchantsku" "465056245"},"createddate" "2019 09 15t00 11 33 987654z"} example v4 body without whitespace {"id" "87f0a400 c84c 4b6b 8722 8fb8447f9565","type" "commission","action" "create","payload" {"commissionid" 775109,"applicationid" 0,"merchantid" 98813,"deviceid" 12345,"saleamount" {"amount" "384 65","currency" "usd"},"amounts" \[{"amount" "2 88475","currency" "usd","splitpart" "application"},{"amount" "5 7695","currency" "usd","splitpart" "device"}],"status" "paid","trackingcode" "012345 6780a bcdef0 74932","eventdate" "2022 10 27t23 08 45z","lockingdate" "2022 10 27t23 08 45z","createddate" "2022 10 27t23 08 45 898588z","modifieddate" "2022 10 27t23 13 45 898588z","merchantorderid" "1234582725","merchantsku" "sku123nd"} callback key values id the callback id note that this is different from the commission id every callback request will have a unique callback id, but it may have the same commission id (i e in the case of an update) there is a button in partner admin that allows a user to resend a callback to your callback receiver url every time that resend callback button is selected, a new callback will fire with a unique callback id but the same commission id type "commission" action "create", "update" commission payload key values commissionid unique id for this commission, when updates are sent this id will be the same applicationid the id of the application with which the purchase was made deviceid the id for the user’s device that made the purchase merchantid the id for a merchant this value can be used to match to a merchant in the json feed saleamount amount reported sale amount from merchant note some merchants don't report sale amount, this can be 0 currency the original currency in which the purchase was made this value is not converted to the application default currency amounts this is an array with up to two maps with data for the user’s earnings and the application’s earnings if you pay your end user you will only see a map for the application splitpart if wildfire pays your end users you will see two maps, one containing the user’s earnings and the other containing the application’s earnings amount the commission amount, this can be a negative number in the case of a canceled or returned order to offset the original commission (this will have a new id) currency commissions are always converted to your application's default currency (e g if your default currency is cad, this value will be sent via api and callback in cad) splitpart a split part is the amount of money allocated to one or two entities depending on the configuration of your application(s) in instances where you pay your end users directly, you will only ever see an application split part if wildfire pays your end users on your behalf, this response will include both the application splitpart and the device (end user) splitpart note splitpart was added in v4 of commission records application represents your portion of a commission device represents the end user's portion of a commission only present in cases where wildfire is paying your end user list of all statuses “pending” is the default state of a new commission that is expected to earn a commission amount (i e not disqualified) “confirmed” indicates that the merchant has locked the commission and has committed to making a payment for that individual earning though this signal indicates a commitment from the merchant, it should be viewed the same as the pending status from a risk perspective as no money has changed hands (i e the merchant has not paid the network) note confirmed status was added in v4 of commission records “ready” indicates that the merchant has paid us for the commission and the payment is just awaiting the next payment cycle (at the beginning of each month) “paid” indicates that the record has been paid to the partner (and the user, if wildfire pays users on behalf of the partner), and the commission should be included in the relevant payment report trackingcode this is the value referred to tracking code (tc) parameter docid\ pl3 phzaubmp4kwtmqukx eventdate timestamp for when the order was placed createddate timestamp for when the commission was entered into our database modifieddate timestamp for the last time this commission was modified in our database lockingdate the period of time that the merchants give themselves to reverse or adjust a commission merchantorderid order id provided by the merchant for this commission note\ this value may be blank, not every merchant reports an order id merchantsku sku number for item purchased note this value may be blank, not every merchant reports sku values callback headers the headers for a callback will look like this { "user agent" "wildlink callback bot/1 0", "content length" "412", "cache control" "no cache", "content type" "application/json", "x wf signature" "sha256=c8abc5baf0a109d3365f90b1f783a9f71eaecd1746fcf39b9b4b1b3417b84cca", "accept encoding" "gzip" } note the "x wf signature" value is the hmac encoded value of the post body using a sha256 encoding type and using the callback key value that you set a php example for how to generate this signature (to compare it to the one in the headers to verify that the request is authentic) looks like this $post body = file get contents('php\ //input'); $signature = hash hmac("sha256", $post body, $callback key); note altering the body of the callback sent by wildfire will result in a mismatched signature retry logic and ensuring against missed records at the time of the writing of this article, wildfire does not support retrying failed callbacks we do intend to add this feature in the future, but in the meantime we recommend using the api calls (see get all commissions https //documenter getpostman com/view/24961/rwgqvyv2#5cc69c1d fb39 4231 894e 7acf25487c6f ) on a regular basis (i e daily) to compensate for the possibility of incomplete callbacks how to get started with commission callbacks if you would like to set up commission callbacks, you may do so via the partner admin under a given application's settings screen navigate to https //platform wildlink me/ select the application you'd like to configure callbacks for select the three dots overflow menu in the top right (see fig 1) select "settings" from the menu input the callback url (this needs to be a full url available to the public) and callback key (this can be any value you choose) you'd like to use (see fig 2) select the callback version you'd like to use (the newest version is usually preferred as it includes more details about each commission record) save note it can take a few minutes before the changes take effect once you set up your callback settings, you'll be able to resend callbacks from the commission history to test your receiving script (see fig 3)