Purchases
Shieldware Inc leverages Cleverbridge's GraphQL API's offerings to enhance their capabilities with localized pricing, retrieving customer purchase data, and generating personalized emails, thereby optimizing their sales strategy and providing a seamless customer experience. By integrating these features into their systems, Shieldware ensures that their website offers dynamic pricing based on user location, gains insights into customer buying patterns, and communicates effectively with customers through automated email generation.
Display Local Pricing on Website
During a website re-branding effort, Shieldware decides that they would like to create a plan selection page that automatically changes the currency, pricing, and descriptions of their plans based on the user's IP address. To do so, they integrate the GraphQL API directly into their website. They call the API whenever a customer opens their plan selection page.
Important
If you do not set the
countryId
,currencyId
, andlanguageId
, the values of these parameters are based on the following:
- The user's IP address is used to determine the country and currency.
- The user's browser settings is used to determine the language.
You can use the GraphQL API to populate your website with real-time product, price, and promotion data for one or more products. To do so, use the cart
query object whenever a customer opens your website. You must provide your Cleverbridge clientId
and your product_id
or internalproduct_id
in the request. All other fields are optional.
Example Request
query {
cart(
cartInput: {
clientId: 864
cartItems: [
{ productId: 97771 }
{ productId: 97775 }
{ productId: 219375 }
]
}
) {
remoteIpAddress
totalPrice {
net {
localized
value
}
tax {
localized
value
}
}
language {
isoCode
}
locale
userLanguages
cartItems {
singlePrice {
net {
localized
value
}
tax {
localized
value
}
}
}
}
}
The API call returns the cart
object with the fields that you requested. All product and pricing information that is returned corresponds to the remoteIpAddress
of the web browser from which the request was made.
Example Response
{
"data": {
"cart": {
"remoteIpAddress": "88.64.247.16",
"totalPrice": {
"net": {
"localized": "€18.98",
"value": 18.98
},
"tax": {
"localized": "€2.93",
"value": 2.93
}
},
"language": {
"isoCode": "en"
},
"locale": "en-US",
"userLanguages": [
"en-GB",
"en-US;q=0.9",
"en;q=0.8",
"fr;q=0.7",
"de;q=0.6"
],
"cartItems": [
{
"singlePrice": {
"net": {
"localized": "€5.03",
"value": 5.03
},
"tax": {
"localized": "€0.95",
"value": 0.95
}
}
},
{
"singlePrice": {
"net": {
"localized": "€8.36",
"value": 8.36
},
"tax": {
"localized": "€1.59",
"value": 1.59
}
}
},
{
"singlePrice": {
"net": {
"localized": "€5.59",
"value": 5.59
},
"tax": {
"localized": "€0.39",
"value": 0.39
}
}
}
]
}
}
}
You can now integrate this information into your website.
Fetch Purchases with Specific Search Parameters
Shieldware, Inc. offers security software for small and medium-sized businesses on the basis of annual subscriptions. They use Cleverbridge's Customer Assistant to monitor their purchases. To make the most of customer data and create better strategies to increase revenue, Shieldware's development department integrated their Salesforce account with the Cleverbridge GraphQL API. This integration enables you to track previous purchase information of customers without opening the Customer Assistant. As a result, Salesforce becomes the single point of truth for identifying customers' buying patterns.
You can use the GraphQL API to search for your customers’ previous purchases by email address, customer, or company name, etc. To use the purchaseSearch
query object, you must specify the PurchaseSearchParameters
in the argument.
Note
If you don't set a
limit
for thepurchaseSearch
query object, all purchases that match the search parameters will be retrieved.
Example Request
query {
purchaseSearch(
purchaseSearchParameters: {
limit: 20
email: { value: "[email protected]", relationalOperator: EQUAL }
}
) {
purchases {
paymentDate
paymentType {
id
name
}
customerId
products {
productId
productName
}
customerGross {
value
currency {
id
}
}
extraParameters {
key
value
}
}
}
}
The API call returns the purchaseSearch
object with the requested fields.
Example Response
{
"data": {
"purchaseSearch": {
"purchases": [
{
"paymentDate": "2018-04-04T12:02:26.781125Z",
"paymentType": {
"id": "VISA",
"name": "Visa"
},
"customerId": 92826256,
"products": [
{
"productId": 144003,
"productName": "test1"
}
],
"customerGross": {
"value": 146.37,
"currency": {
"id": "EUR"
}
},
"extraParameters": [
{
"key": "x-iscompany",
"value": "NO"
}
]
},
{
"paymentDate": "2018-04-04T12:06:40.414424Z",
"paymentType": {
"id": "VISA",
"name": "Visa"
},
"customerId": 92826339,
"products": [
{
"productId": 144003,
"productName": "test1"
}
],
"customerGross": {
"value": 146.37,
"currency": {
"id": "EUR"
}
},
"extraParameters": [
{
"key": "x-iscompany",
"value": "NO"
}
]
},
{
"paymentDate": "2018-04-06T12:10:22.310899Z",
"paymentType": {
"id": "VISA",
"name": "Visa"
},
"customerId": 92876244,
"products": [
{
"productId": 97771,
"productName": "Internet Security Basic Extended"
}
],
"customerGross": {
"value": 5.32,
"currency": {
"id": "EUR"
}
},
"extraParameters": []
},
{
"paymentDate": "2018-07-16T11:37:27.884477Z",
"paymentType": {
"id": "VISA",
"name": "Visa"
},
"customerId": 95125858,
"products": [
{
"productId": 215133,
"productName": "Internet Security Basic Extended"
}
],
"customerGross": {
"value": 24.95,
"currency": {
"id": "USD"
}
},
"extraParameters": [
{
"key": "x-iscompany",
"value": "NO"
}
]
},
{
"paymentDate": "2018-09-25T13:28:05.084215Z",
"paymentType": {
"id": "VISA",
"name": "Visa"
},
"customerId": 96726454,
"products": [
{
"productId": 216494,
"productName": "Hyperdrive Software"
}
],
"customerGross": {
"value": 9.99,
"currency": {
"id": "EUR"
}
},
"extraParameters": [
{
"key": "x-iscompany",
"value": "NO"
}
]
},
{
"paymentDate": "2019-04-04T12:18:56.445209Z",
"paymentType": {
"id": "VISA",
"name": "Visa"
},
"customerId": 92826339,
"products": [
{
"productId": 144003,
"productName": "test1"
}
],
"customerGross": {
"value": 146.37,
"currency": {
"id": "EUR"
}
},
"extraParameters": [
{
"key": "x-iscompany",
"value": "NO"
}
]
},
{
"paymentDate": "2019-04-04T12:18:56.732997Z",
"paymentType": {
"id": "VISA",
"name": "Visa"
},
"customerId": 92826256,
"products": [
{
"productId": 144003,
"productName": "test1"
}
],
"customerGross": {
"value": 146.37,
"currency": {
"id": "EUR"
}
},
"extraParameters": [
{
"key": "x-iscompany",
"value": "NO"
}
]
},
{
"paymentDate": "2019-04-06T12:19:41.026958Z",
"paymentType": {
"id": "VISA",
"name": "Visa"
},
"customerId": 92876244,
"products": [
{
"productId": 97771,
"productName": "Internet Security Basic Extended"
}
],
"customerGross": {
"value": 5.32,
"currency": {
"id": "EUR"
}
},
"extraParameters": []
},
{
"paymentDate": "2019-09-25T13:31:14.579607Z",
"paymentType": {
"id": "VISA",
"name": "Visa"
},
"customerId": 96726454,
"products": [
{
"productId": 216494,
"productName": "Hyperdrive Software"
}
],
"customerGross": {
"value": 9.99,
"currency": {
"id": "EUR"
}
},
"extraParameters": [
{
"key": "x-iscompany",
"value": "NO"
}
]
},
{
"paymentDate": null,
"paymentType": {
"id": "VISA",
"name": "Visa"
},
"customerId": 106496375,
"products": [
{
"productId": 33172,
"productName": "Acme Anti-Spyware"
}
],
"customerGross": {
"value": 29.95,
"currency": {
"id": "USD"
}
},
"extraParameters": [
{
"key": "x-iscompany",
"value": "NO"
}
]
},
{
"paymentDate": "2019-11-12T12:40:23.345132Z",
"paymentType": {
"id": "VISA",
"name": "Visa"
},
"customerId": 106497633,
"products": [
{
"productId": 96909,
"productName": "Normal Product C"
}
],
"customerGross": {
"value": 39.95,
"currency": {
"id": "EUR"
}
},
"extraParameters": [
{
"key": "x-iscompany",
"value": "NO"
}
]
},
{
"paymentDate": "2019-11-12T13:56:08.898569Z",
"paymentType": {
"id": "VISA",
"name": "Visa"
},
"customerId": 106499265,
"products": [
{
"productId": 219783,
"productName": "Film Now"
}
],
"customerGross": {
"value": 9.99,
"currency": {
"id": "EUR"
}
},
"extraParameters": []
},
{
"paymentDate": "2019-11-14T10:34:42.835192Z",
"paymentType": {
"id": "VISA",
"name": "Visa"
},
"customerId": 106544904,
"products": [
{
"productId": 219783,
"productName": "Film Now"
}
],
"customerGross": {
"value": 9.99,
"currency": {
"id": "USD"
}
},
"extraParameters": []
},
{
"paymentDate": "2020-03-03T16:17:30.751572Z",
"paymentType": {
"id": "VISA",
"name": "Visa"
},
"customerId": 109276250,
"products": [
{
"productId": 201833,
"productName": "CB Premium"
}
],
"customerGross": {
"value": 40.25,
"currency": {
"id": "EUR"
}
},
"extraParameters": [
{
"key": "x-iscompany",
"value": "NO"
}
]
}
]
}
}
}
Generate a New Email For a Purchase
Shieldware, Inc. offers security software for small and medium-sized businesses on the basis of annual subscriptions. They sell their software through Cleverbridge and use Salesforce as their CRM tool. To boost sales and optimize their customer lifecycle management, their development department generates emails for purchases using the GraphQL API and pushes them to Salesforce. As a result, their CRM becomes the single source of truth for communication with customers.
You can use the GraphQL API to generate a new email for an existing purchase. To use the generateMail
mutation object, you must provide the purchaseId
and mailType
in the request.
Note
You can specify a
recipient
for thegenerateMail
mutation object that is different from thecontact
used for the purchase. To automatically use thecontact
that the customer provided, do not include therecipient
parameter.
Example Request
mutation {
generateMail(
purchaseId: 218155946
mailType: INVOICE
recipient: "[email protected]"
) {
emails {
mailType {
id
name
}
bodyPlain
toAddress
creationTime
deliveryTime
status {
id
name
}
}
}
}
Example Response
The API call returns the generateMail
object with a list of all generated emails for the purchase.
{
"data": {
"generateMail": {
"emails": [
{
"mailType": {
"id": "INVOICE",
"name": "Customer -> Invoice"
},
"bodyPlain": "Dear Aria Stark,\r\n\r\nThank you for your order of the product Internet Security Professional.\r\n\r\nyour Cleverbridge reference number for this order is 218155946.\r\n\r\nTo ensure the most prompt and efficient service, please always refer to\r\nyour reference number when contacting us.\r\n\r\n\r\nPRODUCT DELIVERY INFORMATION\r\n\r\nPlease visit the following web page to get detailed information on the\r\ndelivery of Internet Security Professional:\r\n\r\nhttps://www-dev.cgn.cleverbridge.com/864/p/218155946-1pxWTGSOAYynFLNmGMMT?\r\n\r\n\r\nPAYMENT INFORMATION\r\n\r\n\r\n\r\nhttps://www-dev.cgn.cleverbridge.com/864/p/218155946-1pxWTGSOAYynFLNmGMMT?\r\n\r\n\r\n\r\nYOUR INVOICE\r\n\r\nAttached to this email you will find the invoice for your order.\r\nAlternatively, you can download the invoice at\r\n\r\nhttps://www-dev.cgn.cleverbridge.com/864/p/218155946-1pxWTGSOAYynFLNmGMMT?\r\n\r\nA PDF with the General Terms and Conditions of Business of cleverbridge\r\nAG is attached to this email.\r\n\r\n\r\nCANCEL YOUR SUBSCRIPTION\r\n\r\nIn case you want to cancel your subscription, please find the option to\r\ndo so on the following page:\r\n\r\nhttps://www-dev.cgn.cleverbridge.com/864/p/218155946-1pxWTGSOAYynFLNmGMMT?\r\n\r\n\r\nSUPPORT OPTIONS\r\n\r\n\r\nTechnical and product-related support\r\n\r\nIf you have any technical or product-related inquiries, please contact\r\nShieldware (Example Company) using the following information:\r\n\r\nWebsite: http://www.shieldwareexamplecompany.com/support\r\nEmail: [email protected]\r\nPhone: 18005551212\r\nFax: 18005551213\r\n\r\n\r\nPayment and order-related support\r\n\r\nIf you have any payment or order-related inquiries, feel free to contact\r\nCleverbridge Customer Support:\r\n\r\nhttps://www-dev.cgn.cleverbridge.com/864/ma/cuseco/218155946-1pxWTGSOAYynFLNmGMMT?\r\n\r\nThank you for using Cleverbridge services for your online purchase.\r\n\r\n\r\nSincerely,\r\nCleverbridge Customer Support\r\n\r\n\r\nCleverbridge GmbH\r\nGereonstr. 43-65 - 50670 Cologne - Germany\r\n\r\r\nChairman of Supervisory Board: Dr. Michael Inhester\r\nRegistry court: HRB 58900 - Local Court of Cologne",
"toAddress": "[email protected]",
"creationTime": "2020-08-07T10:28:23.376852Z",
"deliveryTime": "2020-08-07T10:33:02.624285Z",
"status": {
"id": "SENT",
"name": "Sent"
}
},
{
"mailType": {
"id": "ORDER_CONFIRMATION",
"name": "Customer -> Order confirmation"
},
"bodyPlain": "Dear Aria Stark,\r\n\r\nThank you for your order of the product Internet Security Bundle - Basic\r\nExtended plus Computer Optimization and Shredder.\r\n\r\nyour Cleverbridge reference number for this order is 218155823.\r\n\r\nTo ensure the most prompt and efficient service, please always refer to\r\nyour reference number when contacting us.\r\n\r\n\r\nOUR PAYMENT DETAILS\r\n\r\n\r\n\r\nhttps://www-dev.cgn.cleverbridge.com/864/p/218155823-6ot3QXlqWhVypj2eD4hG?\r\n\r\n\r\n\r\nCHANGE PAYMENT OPTION\r\n\r\nPlease click below if you would like to choose a different payment\r\noption on our secure website. Other payment options, such as credit\r\ncard, may allow you to receive your product sooner.\r\n\r\nhttps://www-dev.cgn.cleverbridge.com/864/cp/218155823-6ot3QXlqWhVypj2eD4hG?\r\n\r\n\r\nORDER CONFIRMATION\r\n\r\nAttached to this email you will find the order confirmation for your\r\norder. Alternatively, you can download it here:\r\n\r\nhttps://www-dev.cgn.cleverbridge.com/864/p/218155823-6ot3QXlqWhVypj2eD4hG?\r\n\r\n\r\nSUPPORT OPTIONS\r\n\r\n\r\nTechnical and product-related support\r\n\r\nIf you have any technical or product-related inquiries, please contact\r\nShieldware (Example Company) using the following information:\r\n\r\nWebsite: http://www.shieldwareexamplecompany.com\r\nEmail: [email protected]\r\nPhone: 18005551212\r\nFax: 18005551213\r\n\r\n\r\nPayment and order-related support\r\n\r\nIf you have any payment or order-related inquiries, feel free to contact\r\nCleverbridge Customer Support:\r\n\r\nhttps://www-dev.cgn.cleverbridge.com/864/ma/cuseco/218155823-6ot3QXlqWhVypj2eD4hG?\r\n\r\nThank you for using Cleverbridge services for your online purchase.\r\n\r\n\r\nSincerely,\r\nCleverbridge Customer Support\r\n\r\n\r\nCleverbridge GmbH\r\nGereonstr. 43-65 - 50670 Cologne - Germany\r\n\r\r\nChairman of Supervisory Board: Dr. Michael Inhester\r\nRegistry court: HRB 58900 - Local Court of Cologne",
"toAddress": "[email protected]",
"creationTime": "2020-08-06T17:04:53.518384Z",
"deliveryTime": "2020-08-06T17:08:18.557812Z",
"status": {
"id": "SENT",
"name": "Sent"
}
},
{
"mailType": {
"id": "INVOICE",
"name": "Customer -> Invoice"
},
"bodyPlain": "Dear Aria Stark,\r\n\r\nThank you for your order of the product Internet Security Bundle - Basic\r\nExtended plus Computer Optimization and Shredder.\r\n\r\nyour Cleverbridge reference number for this order is 218155823.\r\n\r\nTo ensure the most prompt and efficient service, please always refer to\r\nyour reference number when contacting us.\r\n\r\n\r\nPRODUCT DELIVERY INFORMATION\r\n\r\nPlease visit the following web page to get detailed information on the\r\ndelivery of Internet Security Bundle - Basic Extended plus Computer\r\nOptimization and Shredder:\r\n\r\nhttps://www-dev.cgn.cleverbridge.com/864/p/218155823-6ot3QXlqWhVypj2eD4hG?\r\n\r\n\r\nPAYMENT INFORMATION\r\n\r\n\r\n\r\nhttps://www-dev.cgn.cleverbridge.com/864/p/218155823-6ot3QXlqWhVypj2eD4hG?\r\n\r\n\r\n\r\nYOUR INVOICE\r\n\r\nAttached to this email you will find the invoice for your order.\r\nAlternatively, you can download the invoice at\r\n\r\nhttps://www-dev.cgn.cleverbridge.com/864/p/218155823-6ot3QXlqWhVypj2eD4hG?\r\n\r\nA PDF with the General Terms and Conditions of Business of cleverbridge\r\nAG is attached to this email.\r\n\r\n\r\nCANCEL YOUR SUBSCRIPTION\r\n\r\nIn case you want to cancel your subscription, please find the option to\r\ndo so on the following page:\r\n\r\nhttps://www-dev.cgn.cleverbridge.com/864/p/218155823-6ot3QXlqWhVypj2eD4hG?\r\n\r\n\r\nSUPPORT OPTIONS\r\n\r\n\r\nTechnical and product-related support\r\n\r\nIf you have any technical or product-related inquiries, please contact\r\nShieldware (Example Company) using the following information:\r\n\r\nWebsite: http://www.shieldwareexamplecompany.com\r\nEmail: [email protected]\r\nPhone: 18005551212\r\nFax: 18005551213\r\n\r\n\r\nPayment and order-related support\r\n\r\nIf you have any payment or order-related inquiries, feel free to contact\r\nCleverbridge Customer Support:\r\n\r\nhttps://www-dev.cgn.cleverbridge.com/864/ma/cuseco/218155823-6ot3QXlqWhVypj2eD4hG?\r\n\r\nThank you for using Cleverbridge services for your online purchase.\r\n\r\n\r\nSincerely,\r\nCleverbridge Customer Support\r\n\r\n\r\nCleverbridge GmbH\r\nGereonstr. 43-65 - 50670 Cologne - Germany\r\n\r\r\nChairman of Supervisory Board: Dr. Michael Inhester\r\nRegistry court: HRB 58900 - Local Court of Cologne",
"toAddress": "[email protected]",
"creationTime": "2020-08-07T09:03:48.276207Z",
"deliveryTime": "2020-08-07T09:07:35.318213Z",
"status": {
"id": "SENT",
"name": "Sent"
}
}
]
}
}
}
View Purchase Documents
To reduce the customer contact rate and improve the overall customer experience, Shieldware, Inc. gives their customers access to all purchase documents in a self-service portal, for example invoices and credit notes. Shieldware's development team fetches the purchase documents sent by Cleverbridge to the customer, using the GraphQL API, and pushes them to the customer self-service portal.
You can use the GraphQL API to get all documents that a customer has received for a specific purchase and display them in another system. To do so, use the purchaseDocuments
query. You must provide the id
of the purchase and specify the fields you would like to return.
Example Request
query {
purchaseDocuments(purchaseId: 123805998) {
documentDate
downloadLink
id
invoiceNumber
purchaseDocumentType {
id
name
}
}
}
The API call returns an array of PurchaseDocuments
objects with the requested fields, for example downloadLink
or purchaseDocumentType
.
Example Response
{
"data": {
"purchaseDocuments": [
{
"documentDate": "2019-09-13",
"downloadLink": "https://www.cleverbridge.com/invoice/M31fkAQqNwBsWSmpcDzF/AKD-73673324860.pdf",
"id": 160969966,
"invoiceNumber": "AKD-73673324860",
"purchaseDocumentType": {
"id": "REFUND",
"name": "Refund"
}
},
{
"documentDate": "2017-11-16",
"downloadLink": "https://www.cleverbridge.com/invoice/4U2VTNHYNR0XAYN1L751/AKD-73659118411.pdf",
"id": 128058120,
"invoiceNumber": "AKD-73659118411",
"purchaseDocumentType": {
"id": "INVOICE",
"name": "Invoice"
}
}
]
}
}
You can now push this information to the application of your choice.
View Purchase Information
To reduce the customer contact rate and improve the overall customer experience, Shieldware, Inc. gives their customers access to the following purchase information in a self-service portal:
- purchase date and reference number
- products purchased, including price and license key/download link
- contact information, for example: email address and physical address
Shieldware's development team fetches the purchase information, using the GraphQL API, and pushes it to the customer self-service portal.
You can use the GraphQL API to get detailed information about a specific purchase and display it in another system. To do so, use the Purchase
query object. You must provide the id
of the purchase and specify the fields you would like to return.
Example Request
query {
purchase(id: 123805998) {
orderDate
id
items {
customerPricing {
discount {
gross {
localized
}
net {
localized
}
vat {
localized
}
}
price {
gross {
localized
}
net {
localized
}
vat {
localized
}
}
totalPrice {
gross {
localized
}
net {
localized
}
vat {
localized
}
}
}
deliveries {
productDeliveryRunningNo
quantityRunningNo
resultRaw
}
productInformation {
internalProductId
isSubscription
productName
}
quantity
runningNumber
vatRate {
localized
}
}
billingContact {
addressLine1
city
company
country {
name
}
email
firstName
lastName
postalCode
vatId
}
}
}
The API call returns the purchase
object with the specified fields, for example orderDate
, id
, or items
. The items
array contains one object per purchased product.
Example Response
{
"data": {
"purchase": {
"orderDate": "2017-11-16T16:30:59.070264Z",
"id": 123805998,
"items": [
{
"customerPricing": {
"discount": null,
"price": {
"gross": {
"localized": "€9.99"
},
"net": {
"localized": "€8.09"
},
"vat": {
"localized": "€1.90"
}
},
"totalPrice": {
"gross": {
"localized": "€9.99"
},
"net": {
"localized": "€8.09"
},
"vat": {
"localized": "€1.90"
}
}
},
"deliveries": [
{
"productDeliveryRunningNo": 1,
"quantityRunningNo": 1,
"resultRaw": "5089643310"
}
],
"productInformation": {
"internalProductId": "123456",
"isSubscription": true,
"productName": "Internet Security Basic"
},
"quantity": 1,
"runningNumber": 1,
"vatRate": {
"localized": "19 %"
}
}
],
"billingContact": {
"addressLine1": "Gereonstr. 43",
"city": "Köln",
"company": null,
"country": {
"name": "Germany"
},
"email": "[email protected]",
"firstName": "Han",
"lastName": "Solo",
"phone1": null,
"postalCode": "50670",
"vatId": null
}
}
}
}
You can now push this information to the application of your choice.
Updated over 1 year ago