Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WirecardMobileServices/e10785add82b5b4197a54f51e6e2d0a9 to your computer and use it in GitHub Desktop.
Save WirecardMobileServices/e10785add82b5b4197a54f51e6e2d0a9 to your computer and use it in GitHub Desktop.
Receipt creation
//We assume you have complete a Sale or retreived a Sale Response using History query/search.
//Note: having a valid Sale Response object is mandatory for the steps below.
let saleResponse: WDSaleResponse = WDSaleResponse() //In your code, instead of an empty sale, saleResponse is your actual sale response object
//Receipt for individual payments:
//If you want the receipt for a payment you know its id (instead of the whole Sale), you can get the saleResponse of that subPayment by using the function:
//let subPaymentResponse = saleResponse.paymentForReceipt:yourPaymentId
//subPaymentResponse.receipt(:showReturns:format:...
saleResponse.receipt(true, //Is the receipt for cardholder use? For more details, see documentation above
showReturns: false, //Should the receipt contain returns?
format: WDPrintFormat.datecs, //The receipt format (in this case, for portable Datecs, but could be PDF, html, etc.)
dpi: WDPrintDpi.default, //The dots per width is set to Default - valid for Datecs or AirPrint
completion: { (receipt: Any?, error: Error?) in
//For more details on printing receipt, see the Printer Manager section
})
//Note: Other variations of the function above are offered to you for choosing the language and locale of the receipt content.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment