Welcome to the PushGuard REST API. You can use our API to access PushGuard API endpoints to build your own systems on top of our platform.
We have official API libraries in multiple languages. You can view code examples to the right, and you can switch the programming language of the examples with the language selector at the top or any code block.
https://pushguard.net/api/v2/
gem install PushGuard
PushGuard's API uses Basic authentication with your account email and API key. This is usually done via the Authorization
header.
Your API key can be accessed and re-generated here
All API requests must be made over HTTPS.
require 'PushGuard'PushGuard.api_key = 'api key'PushGuard.api_email = 'email'
PushGuard offers the ability to paginate any list endpoint. The X-Total-Pages
header returns the total number of pages for the resources at the specific endpoint you're using.
By default, 20
resources are displayed per page.
# Page 10PushGuard::Orders::List(page: 10)# Page 10 and 50 per pagePushGuard::Orders::List(page: 10, per_page: 50)
Errors will only ever be present with a 400
to 503
HTTP response status. All errors will include a message
attribute detailing the error message.
Validation errors will feature a errors
attribute containing an array of error message strings.
The PushGuard API uses the following error codes:
Status | Meaning |
---|---|
400 | Bad Request - Invalid parameters |
401 | Unauthorized - Unable to authenticate |
403 | Forbidden - The request is not allowed |
404 | Not Found - The specified resource could not be found. |
406 | Not Acceptable - You requested a format that isn't json. |
429 | Too Many Requests - You have reached the rate limit |
500 | Internal Server Error - We had a problem with our server. Try again later. These are rare. |
503 | Service Unavailable - We're temporarily offline for maintenance. Please try again later. |
{"message": "Unable to authenticate"}
{"message": "You are not authorized to perform this action"}
{"message": "Validation failed","errors": ["Title can't be blank","Title is too short (minimum is 2 characters)","Title must be present"]}
PushGuard provides a webhooks system allowing you to subscribe to to events with Webhook Endpoints, alongside Product/Payment Order status webhooks and Dynamic Product webhooks.
Please note only HTTPS webhook URLs are supported.
A webhook simulator is available allowing you to simulate webhooks to a URL. It can be accessed here.
To verify the authenticity of a webhook request and its payload, each webhook request includes a X-PushGuard-Signature
header with a HMAC signature comprised of the JSON encoded request body and your webhook secret. Your webhook secret can be changed in your settings page.
Each webhook request will feature a X-PushGuard-Event
header containing the webhook event type. A list of supported events from Webhook Endpoints can be found below.
Event |
---|
feedback:updated |
order:created |
order:updated |
order:paid |
product:out_of_stock |
query:created |
query:replied |
Each webhook request will create a Webhook Log. The object is created by the request has been sent. Before the request response has actually been received, the response_code
will be 0
, indicating it is pending.
Each webhook request will also include a X-PushGuard-Webhook
request header containing the Webhook Log id
.
require 'openssl'require 'active_support'secret = 'your webhook secret'signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha512'), secret, payload.to_json)is_valid_signature = ActiveSupport::SecurityUtils.secure_compare(request.headers['X-PushGuard-Signature'], signature)if is_valid_signature# Webhook is validend
{"id": "bGYSEexV","blocked_data": "ZW","blacklist_type": 3,"note": "This is a demo blacklist","created_at": "2019-12-28T16:47:01.000+00:00","updated_at": "2019-12-28T16:47:01.000+00:00"}
Returns a list of the Blacklist. The blacklist are sorted by creation date, with the most recently created blacklist being first.
PushGuard::Blacklist.list
[{"id": "bGYSEexV","blocked_data": "ZW","blacklist_type": 3,"note": "This is a demo blacklist","created_at": "2019-12-28T16:47:01.000+00:00","updated_at": "2019-12-28T16:47:01.000+00:00"}]
Retrieves a Blacklist by ID
PushGuard::Blacklist.retrieve('bGYSEexV')
{"id": "bGYSEexV","blocked_data": "ZW","blacklist_type": 3,"note": "This is a demo blacklist","created_at": "2019-12-28T16:47:01.000+00:00","updated_at": "2019-12-28T16:47:01.000+00:00"}
Creates a Blacklist and return the created Blacklist
PushGuard::Blacklist.create(blocked_data: 'ZW',blacklist_type: 3)
{"id": "bGYSEexV","blocked_data": "ZW","blacklist_type": 3,"note": "This is a demo blacklist","created_at": "2019-12-28T16:47:01.000+00:00","updated_at": "2019-12-28T16:47:01.000+00:00"}
Update a Blacklist by ID and return the updated Blacklist
PushGuard::Blacklist.update('bGYSEexV',blocked_data: 'GR')
{"id": "bGYSEexV","blocked_data": "GR","blacklist_type": 3,"note": "This is a demo blacklist","created_at": "2019-12-28T16:47:01.000+00:00","updated_at": "2019-12-28T16:48:02.000+00:00"}
Destroys a Blacklist by ID
PushGuard::Blacklist.destroy('bGYSEexV')
// No Content: 204 HTTP status
{"id": "1241716288502382593","name": "Block gmail customers if using \"+\" bypass","rule": "customer.email_domain == \"gmail.com\" and customer.email contains \"+\"","action_type": "block","priority": 1,"enabled": true,"created_at": "2020-03-22T13:20:07.636+00:00","updated_at": "2020-03-22T13:20:07.636+00:00"}
Returns a list of the Blacklist Rules. The blacklist rules are sorted by priority and creation date. A rule with a prioty of 1
will be the first value in the list.
[{"id": "1241716288502382593","name": "Block gmail customers if using \"+\" bypass","rule": "customer.email_domain == \"gmail.com\" and customer.email contains \"+\"","action_type": "block","priority": 1,"enabled": true,"created_at": "2020-03-22T13:20:07.636+00:00","updated_at": "2020-03-22T13:20:07.636+00:00"}]
Retrieves a Blacklist Rule by ID
{"id": "1241716288502382593","name": "Block gmail customers if using \"+\" bypass","rule": "customer.email_domain == \"gmail.com\" and customer.email contains \"+\"","action_type": "block","priority": 1,"enabled": true,"created_at": "2020-03-22T13:20:07.636+00:00","updated_at": "2020-03-22T13:20:07.636+00:00"}
Creates a Blacklist Rule and return the created Blacklist Rule
{"id": "1241716288502382593","name": "Block gmail customers if using \"+\" bypass","rule": "customer.email_domain == \"gmail.com\" and customer.email contains \"+\"","action_type": "block","priority": 1,"enabled": true,"created_at": "2020-03-22T13:20:07.636+00:00","updated_at": "2020-03-22T13:20:07.636+00:00"}
Update a Blacklist Rule by ID and return the updated Blacklist Rule
{"id": "1241716288502382593","name": "Block gmail customers if using \"+\" bypass","rule": "customer.email_domain == \"gmail.com\" and customer.email contains \"+\"","action_type": "block","priority": 1,"enabled": true,"created_at": "2020-03-22T13:20:07.636+00:00","updated_at": "2020-03-22T13:20:07.636+00:00"}
Destroys a Blacklist Rule by ID
// No Content: 204 HTTP status
{"id": "1dd671f4","title": "Demo category","product_ids": ["100bcf1e"],"image": {"id": "55e68f9900c08f1dea6aec2ffc9c153856a91d5c/b65fcd4508226e9774445ebb4495048756750738","storage": "cdn","metadata": {"size": 3463,"filename": "logo.png","mime_type": "image/png"},"url": "https://cdn.pushguard.net/cd2de339c0a605dedf29aecd44d3feb002842e60/68747470733a2f2f73656c6c792e6e7963332e6469676974616c6f6365616e7370616365732e636f6d2f63616368652f353565363866393930306330386631646561366165633266666339633135333835366139316435632f6236356663643435303832323665393737343434356562623434393530343837353637"},"unlisted": true,"created_at": "2019-12-25T15:09:13.000+00:00","updated_at": "2019-12-25T15:31:40.000+00:00"}
Returns a list of the Categories. The categories are sorted by creation date, with the most recently created categories being first.
PushGuard::Categories.list
[{"id": "1dd671f4","title": "Demo category","product_ids": ["100bcf1e"],"image": {"id": "55e68f9900c08f1dea6aec2ffc9c153856a91d5c/b65fcd4508226e9774445ebb4495048756750738","storage": "cdn","metadata": {"size": 3463,"filename": "logo.png","mime_type": "image/png"},"url": "https://cdn.pushguard.net/cd2de339c0a605dedf29aecd44d3feb002842e60/68747470733a2f2f73656c6c792e6e7963332e6469676974616c6f6365616e7370616365732e636f6d2f63616368652f353565363866393930306330386631646561366165633266666339633135333835366139316435632f6236356663643435303832323665393737343434356562623434393530343837353637"},"unlisted": true,"created_at": "2019-12-25T15:09:13.000+00:00","updated_at": "2019-12-25T15:31:40.000+00:00"}]
Retrieves a Category by ID
PushGuard::Categories.retrieve('1dd671f4')
{"id": "1dd671f4","title": "Demo category","product_ids": ["100bcf1e"],"image": {"id": "55e68f9900c08f1dea6aec2ffc9c153856a91d5c/b65fcd4508226e9774445ebb4495048756750738","storage": "cdn","metadata": {"size": 3463,"filename": "logo.png","mime_type": "image/png"},"url": "https://cdn.pushguard.net/cd2de339c0a605dedf29aecd44d3feb002842e60/68747470733a2f2f73656c6c792e6e7963332e6469676974616c6f6365616e7370616365732e636f6d2f63616368652f353565363866393930306330386631646561366165633266666339633135333835366139316435632f6236356663643435303832323665393737343434356562623434393530343837353637"},"unlisted": true,"created_at": "2019-12-25T15:09:13.000+00:00","updated_at": "2019-12-25T15:31:40.000+00:00"}
Creates a Category and return the created Category
PushGuard::Category.create(title: 'Demo category',product_ids: ['100bcf1e'])
{"id": "1dd671f4","title": "Demo category","product_ids": ["100bcf1e"],"image": null,"unlisted": true,"created_at": "2019-12-25T15:09:13.000+00:00","updated_at": "2019-12-25T15:31:40.000+00:00"}
Update a Category by ID and return the updated Category
PushGuard::Categories.update('1dd671f4',title: 'Updated title')
{"id": "1dd671f4","title": "Updated title","product_ids": ["100bcf1e"],"image": null,"unlisted": true,"created_at": "2019-12-25T15:09:13.000+00:00","updated_at": "2019-12-25T15:31:40.000+00:00"}
Destroys a Category by ID
PushGuard::Categories.destroy('1dd671f4')
// No Content: 204 HTTP status
Status | Meaning |
---|---|
0 | Not paid |
51 | Chargeback/Reversed |
52 | High risk |
53 | Partially paid |
54 | Awaiting Cryptocurrency confirmations |
55 | Pending - PayPal |
56 | Refunded |
100 | Successful and completed |
{"id": "d73cf5fc-466d-433e-a109-f8de4d4c70fc","product_id": "b3cadd729499","ip_address": "41.117.222.111","country_code": "US","product_title": "Side Direct Filter","user_agent": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36","value": "10.0","quantity": 1,"currency": "USD","gateway": "PayPal","risk_level": 0,"status": 0,"delivered": null,"crypto_value": null,"crypto_address": null,"crypto_channel": null,"crypto_received": 0,"crypto_confirmations": 0,"referral": null,"usd_value": "10.0","exchange_rate": "1.0","coupon_id": null,"custom": {},"created_at": "2019-12-25T15:09:13.000+00:00","updated_at": "2019-12-25T15:31:40.000+00:00"}
Returns a list of the orders. The orders are sorted by creation date, with the most recently created orders being first.
PushGuard::Orders.list
[{"id": "d73cf5fc-466d-433e-a109-f8de4d4c70fc","product_id": "b3cadd729499","ip_address": "41.117.222.111","country_code": "US","product_title": "Side Direct Filter","user_agent": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36","value": "10.0","quantity": 1,"currency": "USD","gateway": "PayPal","risk_level": 0,"status": 0,"delivered": null,"crypto_value": null,"crypto_address": null,"crypto_channel": null,"crypto_received": 0,"crypto_confirmations": 0,"referral": null,"usd_value": "10.0","exchange_rate": "1.0","coupon_id": null,"custom": {},"created_at": "2019-12-25T15:09:13.000+00:00","updated_at": "2019-12-25T15:31:40.000+00:00"}]
Retrieves a Order by ID
PushGuard::Orders.retrieve('d73cf5fc-466d-433e-a109-f8de4d4c70fc')
{"id": "d73cf5fc-466d-433e-a109-f8de4d4c70fc","product_id": "b3cadd729499","ip_address": "41.117.222.111","country_code": "US","product_title": "Side Direct Filter","user_agent": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36","value": "10.0","quantity": 1,"currency": "USD","gateway": "PayPal","risk_level": 0,"status": 0,"delivered": null,"crypto_value": null,"crypto_address": null,"crypto_channel": null,"crypto_received": 0,"crypto_confirmations": 0,"referral": null,"usd_value": "10.0","exchange_rate": "1.0","coupon_id": null,"custom": {},"created_at": "2019-12-25T15:09:13.000+00:00","updated_at": "2019-12-25T15:31:40.000+00:00"}
{"id": "06e53c79","title": "Example Product","description": "This is a _example_ description","stock": "∞","price": "12.99","currency": "USD","product_type": 1,"gateways": ["paypal","bitcoin","ethereum","stripe"],"private": false,"unlisted": false,"vpn_block": false,"seller_note": null,"maximum_quantity": null,"minimum_quantity": 1,"stock_delimiter": ",","stock_amount": null,"image": {"id": "363d570e0192844b7b3abcdc8a0918dc694959b3/fab7a5c54420114cc6edc2ce8336f000dc04153c","storage": "products","metadata": {"size": 26192,"filename": "logo.png","mime_type": "image/png"},"url": "https://cdn.pushguard.net/93b04f18b27b01a9dbdfa3179e7b5/68747470733a2f2f73656c6c792d6465762e6e7963332e6469676974616c6f6365616e7370616365732e636f6d2f70726f64756374732f333633643537306530313932383434623762336162636463386130393138646336393439353962332f66616237613563353434323031313463633665646332636538333336663030306463303431353363"},"theme": 1,"crypto_confirmations": 1,"max_risk_level": 30,"dynamic_url": null,"info": null,"file": {"id": "73065303139323834346237623361626364633861303931386/2f2f73656c6c792d6465762e6e7963332e6469676974616c6f6365616e7370616365732e636f6d2f70726f64756374732f333633643537306530313932383434623762336162636463386130393138646336393439353962332f66616237613563353434323031313463633665646332636538333336?Signature=c0f7b0155e794fab53a7769fb2cdfe24ecedf83a58fb02b81545691925ff234e","storage": "product_files","metadata": {"size": 225894,"mime_type": "application/zip","filename": "my product.zip"},"url": "https://cdn.pushguard.net/73065303139323834346237623361626364633861303931386/2f2f73656c6c792d6465762e6e7963332e6469676974616c6f6365616e7370616365732e636f6d2f70726f64756374732f333633643537306530313932383434623762336162636463386130393138646336393439353962332f66616237613563353434323031313463633665646332636538333336?Signature=c0f7b0155e794fab53a7769fb2cdfe24ecedf83a58fb02b81545691925ff234e"},"paypal_email_delivery": false,"webhook_url": null,"custom": {},"created_at": "2019-12-27T18:23:56.000+00:00","updated_at": "2019-12-27T18:27:15.000+00:00"}
Returns a list of the Products. The products are sorted by creation date, with the most recently created products being first.
PushGuard::Products.list
[{"id": "06e53c79","title": "Example Product","description": "This is a _example_ description","stock": "∞","price": "12.99","currency": "USD","product_type": 1,"gateways": ["paypal","bitcoin","ethereum","stripe"],"private": false,"unlisted": false,"vpn_block": false,"seller_note": null,"maximum_quantity": null,"minimum_quantity": 1,"stock_delimiter": ",","stock_amount": null,"image": {"id": "363d570e0192844b7b3abcdc8a0918dc694959b3/fab7a5c54420114cc6edc2ce8336f000dc04153c","storage": "products","metadata": {"size": 26192,"filename": "logo.png","mime_type": "image/png"},"url": "https://cdn.pushguard.net/93b04f18b27b01a9dbdfa3179e7b5/68747470733a2f2f73656c6c792d6465762e6e7963332e6469676974616c6f6365616e7370616365732e636f6d2f70726f64756374732f333633643537306530313932383434623762336162636463386130393138646336393439353962332f66616237613563353434323031313463633665646332636538333336663030306463303431353363"},"theme": 1,"crypto_confirmations": 1,"max_risk_level": 30,"dynamic_url": null,"info": null,"file": {"id": "73065303139323834346237623361626364633861303931386/2f2f73656c6c792d6465762e6e7963332e6469676974616c6f6365616e7370616365732e636f6d2f70726f64756374732f333633643537306530313932383434623762336162636463386130393138646336393439353962332f66616237613563353434323031313463633665646332636538333336?Signature=c0f7b0155e794fab53a7769fb2cdfe24ecedf83a58fb02b81545691925ff234e","storage": "product_files","metadata": {"size": 225894,"mime_type": "application/zip","filename": "my product.zip"},"url": "https://cdn.pushguard.net/73065303139323834346237623361626364633861303931386/2f2f73656c6c792d6465762e6e7963332e6469676974616c6f6365616e7370616365732e636f6d2f70726f64756374732f333633643537306530313932383434623762336162636463386130393138646336393439353962332f66616237613563353434323031313463633665646332636538333336?Signature=c0f7b0155e794fab53a7769fb2cdfe24ecedf83a58fb02b81545691925ff234e"},"paypal_email_delivery": false,"webhook_url": null,"custom": {},"created_at": "2019-12-27T18:23:56.000+00:00","updated_at": "2019-12-27T18:27:15.000+00:00"}]
Retrieves a Product by ID
PushGuard::Products.retrieve('06e53c79')
{"id": "06e53c79","title": "Example Product","description": "This is a _example_ description","stock": "∞","price": "12.99","currency": "USD","product_type": 1,"gateways": ["paypal","bitcoin","ethereum","stripe"],"private": false,"unlisted": false,"vpn_block": false,"seller_note": null,"maximum_quantity": null,"minimum_quantity": 1,"stock_delimiter": ",","stock_amount": null,"image": {"id": "363d570e0192844b7b3abcdc8a0918dc694959b3/fab7a5c54420114cc6edc2ce8336f000dc04153c","storage": "products","metadata": {"size": 26192,"filename": "logo.png","mime_type": "image/png"},"url": "https://cdn.pushguard.net/93b04f18b27b01a9dbdfa3179e7b5/68747470733a2f2f73656c6c792d6465762e6e7963332e6469676974616c6f6365616e7370616365732e636f6d2f70726f64756374732f333633643537306530313932383434623762336162636463386130393138646336393439353962332f66616237613563353434323031313463633665646332636538333336663030306463303431353363"},"theme": 1,"crypto_confirmations": 1,"max_risk_level": 30,"dynamic_url": null,"info": null,"file": {"id": "73065303139323834346237623361626364633861303931386/2f2f73656c6c792d6465762e6e7963332e6469676974616c6f6365616e7370616365732e636f6d2f70726f64756374732f333633643537306530313932383434623762336162636463386130393138646336393439353962332f66616237613563353434323031313463633665646332636538333336?Signature=c0f7b0155e794fab53a7769fb2cdfe24ecedf83a58fb02b81545691925ff234e","storage": "product_files","metadata": {"size": 225894,"mime_type": "application/zip","filename": "my product.zip"},"url": "https://cdn.pushguard.net/73065303139323834346237623361626364633861303931386/2f2f73656c6c792d6465762e6e7963332e6469676974616c6f6365616e7370616365732e636f6d2f70726f64756374732f333633643537306530313932383434623762336162636463386130393138646336393439353962332f66616237613563353434323031313463633665646332636538333336?Signature=c0f7b0155e794fab53a7769fb2cdfe24ecedf83a58fb02b81545691925ff234e"},"paypal_email_delivery": false,"webhook_url": null,"custom": {},"created_at": "2019-12-27T18:23:56.000+00:00","updated_at": "2019-12-27T18:27:15.000+00:00"}
Creates a Product and return the created Product
PushGuard::Products.create(title: 'Example product',description: 'Example description with _markdown_ support',price: '9.99',currency: 'USD',gateways: ['bitcoin', 'ethereum', 'paypal'],product_type: 2,info: 'SERIAL1, SERIAL2, SERIAL3',stock_delimiter: ',')
{"id": "1a1ffd89","title": "Example product","description": "Example description with _markdown_ support","stock": 1,"price": "9.99","currency": "USD","product_type": 2,"gateways": ["bitcoin","ethereum","paypal"],"private": false,"unlisted": false,"vpn_block": false,"seller_note": null,"maximum_quantity": null,"minimum_quantity": 1,"stock_delimiter": ",","stock_amount": null,"image": null,"theme": 2,"crypto_confirmations": 1,"max_risk_level": 30,"dynamic_url": null,"info": "SERIAL1, SERIAL2, SERIAL3","file": null,"paypal_email_delivery": false,"webhook_url": null,"custom": null,"created_at": "2019-12-25T15:09:13.000+00:00","updated_at": "2019-12-25T15:31:40.000+00:00"}
Update a Product by ID and return the updated Product
PushGuard::Products.update('1a1ffd89',title: 'Updated title',price: '19.49',currency: 'EUR',gateways: ['paypal', 'stripe'])
{"id": "1a1ffd89","title": "Updated title","description": "Example description with _markdown_ support","stock": 1,"price": "19.49","currency": "EUR","product_type": 2,"gateways": ["paypal","stripe"],"private": false,"unlisted": false,"vpn_block": false,"seller_note": null,"maximum_quantity": null,"minimum_quantity": 1,"stock_delimiter": ",","stock_amount": null,"image": null,"theme": 2,"crypto_confirmations": 1,"max_risk_level": 30,"dynamic_url": null,"info": "SERIAL1, SERIAL2, SERIAL3","file": null,"paypal_email_delivery": false,"webhook_url": null,"custom": null,"created_at": "2019-12-25T15:09:13.000+00:00","updated_at": "2019-12-25T15:31:40.000+00:00"}
Destroys a Product by ID
PushGuard::Products.destroy('b47e307a7283')
// No Content: 204 HTTP status
{"id": "1206995986220584961","url": "https://example.com/5f68b177","enabled": true,"events": ["feedback:created","order:paid","order:updated"],"created_at": "2019-12-17T17:54:02.667+00:00","updated_at": "2019-12-17T17:54:02.667+00:00"}
Returns a list of the webhook endpoints. The webhook endpoints are sorted by creation date, with the most recently created webhook endpoints being first.
PushGuard::Webhooks::Endpoints.list
[{"id": "1206995986220584961","url": "https://example.com/5f68b177","enabled": true,"events": ["feedback:created","order:paid","order:updated"],"created_at": "2019-12-17T17:54:02.667+00:00","updated_at": "2019-12-17T17:54:02.667+00:00"}]
Retrieves a Webhook Endpoint by ID
PushGuard::Webhook::Endpoints.retrieve(1206995986220584961)
{"id": "1206995986220584961","url": "https://example.com/5f68b177","enabled": true,"events": ["feedback:created","order:paid","order:updated"],"created_at": "2019-12-17T17:54:02.667+00:00","updated_at": "2019-12-17T17:54:02.667+00:00"}
Creates a Webhook Endpoint and return the created Webhook Endpoint
PushGuard::Webhooks::Endpoints.create(url: 'https://example.com/5f68b177',events: ['feedback:created','order:paid','order:updated'])
{"id": "1206995986220584961","url": "https://example.com/5f68b177","enabled": true,"events": ["feedback:created","order:paid","order:updated"],"created_at": "2019-12-17T17:54:02.667+00:00","updated_at": "2019-12-17T17:54:02.667+00:00"}
Updates a Webhook Endpoint by ID and return the updated Webhook Endpoint
PushGuard::Webhooks::Endpoints.update(1206995986220584961,events: ['order:created','order:paid','query:updated'])
{"id": "1206995986220584961","url": "https://example.com/5f68b177","enabled": true,"events": ["order:created","order:paid","query:created"],"created_at": "2019-12-17T17:54:02.667+00:00","updated_at": "2019-12-17T17:54:02.667+00:00"}
Destroys a Webhook Endpoint by ID
PushGuard::Webhooks::Endpoints.destroy(1206995986220584961)
// No Content: 204 HTTP status
{"id": "67bLhmkZ","url": "https://example.com/5f68b177","payload": {"id": "d73cf5fc-466d-433e-a109-f8de4d4c70fc","product_id": "b3cadd729499","ip_address": "41.117.222.111","country_code": "US","product_title": "Side Direct Filter","user_agent": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36","value": "10.0","quantity": 1,"currency": "USD","gateway": "PayPal","risk_level": 0,"status": 0,"delivered": null,"crypto_value": null,"crypto_address": null,"crypto_channel": null,"crypto_received": 0,"crypto_confirmations": 0,"referral": null,"usd_value": "10.0","exchange_rate": "1.0","coupon_id": null,"custom": {},"created_at": "2019-12-25T15:09:13.000+00:00","updated_at": "2019-12-25T15:31:40.000+00:00"},"response": "{\"success\":true}","response_code": 200,"response_headers": {"Access-Control-Allow-Origin": "*","Content-Type": "application/json; charset=utf-8","Date": "Sat, 21 Dec 2019 18:41:54 UTC","X-Pd-Status": "sent to primary","X-Powered-By": "Express","Content-Length": "16","Connection": "Close"},"retries": 8,"event": "order:created","retry_limit": 10,"next_retry_at": "2019-12-21T18:51:54.000+00:00","created_at": "2019-12-14T17:33:36.000+00:00","updated_at": "2019-12-21T18:41:54.000+00:00"}
Returns a list of the webhook logs. The webhook logs are sorted by creation date, with the most recently created webhook logs being first.
PushGuard::Webhooks::Logs.list
[{"id": "67bLhmkZ","url": "https://example.com/5f68b177","payload": {"id": "d73cf5fc-466d-433e-a109-f8de4d4c70fc","product_id": "b3cadd729499","ip_address": "41.117.222.111","country_code": "US","product_title": "Side Direct Filter","user_agent": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36","value": "10.0","quantity": 1,"currency": "USD","gateway": "PayPal","risk_level": 0,"status": 0,"delivered": null,"crypto_value": null,"crypto_address": null,"crypto_channel": null,"crypto_received": 0,"crypto_confirmations": 0,"referral": null,"usd_value": "10.0","exchange_rate": "1.0","coupon_id": null,"custom": {},"created_at": "2019-12-25T15:09:13.000+00:00","updated_at": "2019-12-25T15:31:40.000+00:00"},"response": "{\"success\":true}","response_code": 200,"response_headers": {"Access-Control-Allow-Origin": "*","Content-Type": "application/json; charset=utf-8","Date": "Sat, 21 Dec 2019 18:41:54 UTC","X-Pd-Status": "sent to primary","X-Powered-By": "Express","Content-Length": "16","Connection": "Close"},"retries": 8,"event": "order:created","retry_limit": 10,"next_retry_at": "2019-12-21T18:51:54.000+00:00","created_at": "2019-12-14T17:33:36.000+00:00","updated_at": "2019-12-21T18:41:54.000+00:00"}]
Retrieves a Webhook Log by ID
PushGuard::Webhook::Log.retrieve('67bLhmkZ')
{"id": "67bLhmkZ","url": "https://example.com/5f68b177","payload": {"id": "d73cf5fc-466d-433e-a109-f8de4d4c70fc","product_id": "b3cadd729499","ip_address": "41.117.222.111","country_code": "US","product_title": "Side Direct Filter","user_agent": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36","value": "10.0","quantity": 1,"currency": "USD","gateway": "PayPal","risk_level": 0,"status": 0,"delivered": null,"crypto_value": null,"crypto_address": null,"crypto_channel": null,"crypto_received": 0,"crypto_confirmations": 0,"referral": null,"usd_value": "10.0","exchange_rate": "1.0","coupon_id": null,"custom": {},"created_at": "2019-12-25T15:09:13.000+00:00","updated_at": "2019-12-25T15:31:40.000+00:00"},"response": "{\"success\":true}","response_code": 200,"response_headers": {"Access-Control-Allow-Origin": "*","Content-Type": "application/json; charset=utf-8","Date": "Sat, 21 Dec 2019 18:41:54 UTC","X-Pd-Status": "sent to primary","X-Powered-By": "Express","Content-Length": "16","Connection": "Close"},"retries": 8,"event": "order:created","retry_limit": 10,"next_retry_at": "2019-12-21T18:51:54.000+00:00","created_at": "2019-12-14T17:33:36.000+00:00","updated_at": "2019-12-21T18:41:54.000+00:00"}
PushGuard Payments provides a central implementation to accept a wide range of payment methods including PayPal, Bitcoin, Ethereum and Litecoin on your own platform.
For the gateway
chosen in the Payment, you must have the correct information (e.g your PayPal email address) set in your shop payments settings.
PushGuard Payments supports a optional webhook_url
paramater, but Webhook Endpoints will also receive all order related events.
Checkout options We currently support two types of checkout flows for PushGuard Payments, Integrated and White-label.
With the integrated checkout option, PushGuard handles the checkout aspect for you by only returning a unique payment URL. This unique URL contains our realtime checkout page.
The white-label checkout flow provides the raw order created rather than a payment URL. With the raw order information, you are able to develop and integrate your own checkout experience completely separate of PushGuard.
This has the added downside of not having the realtime status updates that the integrated checkout flow offers, but this can of course be implemented on your side using the webhooks.
Creates a Payment and return the created Payment
PushGuard::Pay.create(title: 'PushGuard Pay Example',gateway: 'Bitcoin',value: 10.00,currency: 'USD',return_url: 'https://website.com/return')
{"url": "https://pushguard.net/pay/81971eae19ff0924026d7b2a7502b20372c15df5/bGU3Q09QSGtDNjR2cHJMYzhHdTd6Mm40bXpFNVdZOEtlaW9NckRySmxsVkZOSjhkb3N0SVM0cVF6UDJtU0NjejVrT0Q4ZFZKY1JVbi9ZTjJaSDhGRXc9PS0tdW5zUGptYjcrSGZSRjF5K0VmNUFNZz09--68ab83743fa057629b09bb9c7330841e54442784"}
PushGuard::Pay.create(title: 'PushGuard Pay Example',gateway: 'Bitcoin',value: 10.00,currency: 'USD',white_label: true)
{"id": "16d37578-ced4-4a18-90c7-596a8e472e69","status": 0,"crypto_address": null,"crypto_value": null,"confirmations_needed": 6,"product_id": "pay","value": "10.0","quantity": 1,"currency": "USD","gateway": "PayPal","crypto_channel": null,"usd_value": "10.0","exchange_rate": "1.0","created_at": "2018-04-21T13:21:19.000+01:00","updated_at": "2018-04-21T13:21:19.000+01:00","url": "https://www.paypal.com/webscr?cmd=_ap-payment&paykey=AP-5U570312BD011483Y"}
Destroys a Payment by ID
PushGuard::Pay.destroy('81971eae19ff0924026d7b2a7502b20372c15df5')
// No Content: 204 HTTP status