Skip to content

Sale Receipt

In addition to the receipt generation and printing, we offer the option of sending the Sale receipt.

Note that the actual "sending" is not executed from your mobile client (phone or tablet). Instead, the SDK will request our backend to send it. For this reason, the format of the sent receipt is affected by your Merchant configuration, and the option of sending by SMS must be contractually activated in the backend.

The way to request a send of receipt is simple: you need the id of the sale you want the receipt from, and provide a string that can be a phone number (to send the SMS to) or an email address. We will recognize the format and validity of the string accordingly.

The Sample Code

ObjC

// End of Send Receipt process
SendReceiptCompletion completionBlock = ^(NSArray *recipient, NSError *error) {
if (!error) {
//Receipt sent successfully
}
else {
//Failure sending the receipt
}
};
// Sale manager to generate and send the receipt from the backend to the cardholder
[[sdk saleManager] sendReceiptForSale:@"InternalSaleId" // WDSaleResponse.internalId
saleState:WDSaleStateCompleted // WDSaleResponse.status
byEmailOrPhone:@"cardHolder@email.address" // the email address to send the receipt to
completion:completionBlock]; // End of Send Receipt process

Swift

// End of Send Receipt process
let completion: SendReceiptCompletion = { (recipient: Array?, error: Error?) in
guard error != nil else {
//Failure sending the receipt
return
}
//Receipt sent successfully
}
// Sale manager to generate and send the receipt from the backend to the cardholder
sdk.saleManager.sendReceipt(forSale: "InternalSaleId", // WDSaleResponse.internalId
byEmailOrPhone: "cardHolder@email.address", // the email address (or phone number)to send the receipt to
completion: completion) // End of Send Receipt process

import de.wirecard.epos.model.sale.SendingWay;
import de.wirecard.epos.model.with.With;
import de.wirecard.epos.model.with.WithFields;
import io.reactivex.android.schedulers.AndroidSchedulers;
//initialize your params
String id, number;
eposSDK.sales()
.sendReceipt(SendingWay.SMS, id, number) //Which way you want to send Receipt (Email or SMS); id of Sale; number or email adress where you want to send receipt
.observeOn(AndroidSchedulers.mainThread()) // in case you want result in main thread
.subscribe(() -> {
//successfully sent
}, throwable -> {
//error
});
//******************** USING WITH PARAMETER ********************//
WithFields withFields = With.fields().param("type", "FOR_ORIGINAL_SALE"); // add optional parameter type to backend request
eposSDK.sales()
.sendReceipt(SendingWay.SMS, id, number, withFields) //Which way you want to send Receipt (Email or SMS); id of Sale; number or email adress where you want to send receipt
.observeOn(AndroidSchedulers.mainThread()) // in case you want result in main thread
.subscribe(() -> {
//successfully sent
}, throwable -> {
//error
});

Universal Windows Platform SDK coming soon