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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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