Select a receipt
United States
Use the SelectReceiptRequestIntentBuilder
class to build an Intent to start an activity for receipt selection.
Use this Intent to:
- Initiate payment, credit, and refund receipts.
- Configure hide or show options.
- Indicate if a default Clover receipt can be sent.
Prerequisites
- Read overview of the Clover platform.
- Create a global developer account with a default test merchant account.
- Order a Clover Developer Kit (Dev Kit) and set it up.
- Use the required Android SDK versions.
Select a payment receipt
Build a payment receipt selection request.
val paymentId = "<Id of an online Payment>"
val builder = SelectReceiptRequestIntentBuilder.Payment(paymentId)
val intent = builder.build(context)
String paymentId = "<Id of an online Payment>";
SelectReceiptRequestIntentBuilder builder = SelectReceiptRequestIntentBuilder.Payment(paymentId);
Intent intent = builder.build(context);
Select a refund receipt
Build a refund receipt selection request.
val refundId = "<Id of an online Refund>"
val builder = SelectReceiptRequestIntentBuilder.Refund(refundId)
val intent = builder.build(context)
String refundId = "<Id of an online Refund>";
SelectReceiptRequestIntentBuilder builder = SelectReceiptRequestIntentBuilder.Refund(refundId);
Intent intent = builder.build(context);
Select a credit receipt
Build a credit receipt selection request.
val creditId = "<Id of an online Credit>"
val builder = SelectReceiptRequestIntentBuilder.Credit(creditId)
val intent = builder.build(context)
String creditId = "<Id of an online Credit>";
SelectReceiptRequestIntentBuilder builder = SelectReceiptRequestIntentBuilder.Credit(creditId);
Intent intent = builder.build(context);
ReceiptOptions
Use the ReceiptOptions
class to customize the receipt selection screen, such as turn on or turn off SMS/Email/No Receipt/Print options.
Method | Description |
---|---|
smsReceiptOptions(smsReceiptOption : SmsReceiptOption) | Use to turn on or off the SMS receipt option and pass a phone number. |
emailReceiptOptions(emailReceiptOption : EmailReceiptOption) | Use to turn on or off the email receipt option and pass an email address. |
printReceiptOptions(printReceiptOption : PrintReceiptOption) | Use to turn on or off the print receipt option. |
noReceiptReceiptOptions(noReceiptReceiptOption : NoReceiptOption) | Use to turn on or off the no Receipt receipt option. |
Example—Pass a phone number to the SMS receipt option
val paymentId = "<Id of an online Payment>"
val smsReceiptOption = SelectReceiptRequestIntentBuilder.SmsReceiptOption.Enable("5551231234")
val noReceiptOption = SelectReceiptRequestIntentBuilder.NoReceiptOption.Enable()
val printReceiptOption = SelectReceiptRequestIntentBuilder.PrintReceiptOption.Enable()
val emailReceiptOption = SelectReceiptRequestIntentBuilder.EmailReceiptOption.Enable(null)
val builder = SelectReceiptRequestIntentBuilder.Payment(paymentId)
.smsReceiptOptions(smsReceiptOption)
.emailReceiptOptions(emailReceiptOption)
.noReceiptReceiptOptions(noReceiptOption)
.printReceiptOptions(printReceiptOption)
val intent = builder.build(context)
Additional field
Additional field to set on the SelectReceiptRequestIntentBuilder
class.
Field | Description |
---|---|
cloverShouldHandleReceipts : Boolean | Values: - True: Clover handles the delivery of the selected receipt option. - False: Clover does not deliver the selected receipt option; it is retrievable in the response. |
Response details
When the receipt selection flow completes, the response is available through onActivityResult()
.
Check the SelectReceiptRequestIntentBuilder.Response
class for the response fields.
For a successful request:
- Retrieve the payment object using the Intent:
SelectReceiptRequestIntentBuilder.Response.PAYMENT
- Retrieve the status of the receipt delivery, such as Requested or Processed, using the Intent:
SelectReceiptRequestIntentBuilder.Response.RECEIPT_DELIVERY_STATUS
- Retrieve the status of the receipt selection type, such as Email, SMS, Print, or No_Receipt, using the Intent:
SelectReceiptRequestIntentBuilder.Response.RECEIPT_DELIVERY_TYPE
- Retrieve the email or SMS value, such as [email protected] or 5555551234, using the Intent:
SelectReceiptRequestIntentBuilder.Response.ENTERED_RECEIPT_VALUE
Response example
fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == SELECT_RECEIPT_REQUEST_CODE) {
if (resultCode == RESULT_OK) {
val payment: Payment = data.getParcelableExtra(SelectReceiptRequestIntentBuilder.Response.PAYMENT)
val receiptDeliveryStatus = data.getStringExtra(SelectReceiptRequestIntentBuilder.Response.RECEIPT_DELIVERY_STATUS)
val receiptDeliveryType = data.getStringExtra(SelectReceiptRequestIntentBuilder.Response.RECEIPT_DELIVERY_TYPE)
val enteredReceiptValue = data.getStringExtra(SelectReceiptRequestIntentBuilder.Response.ENTERED_RECEIPT_VALUE)
} else {
// select receipt failed, check for error
val failureMessage = data.getStringExtra(SelectReceiptRequestIntentBuilder.Response.FAILURE_MESSAGE)
}
}
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == SELECT_RECEIPT_REQUEST_CODE) {
if (resultCode == RESULT_OK) {
Payment payment = data.getParcelableExtra(SelectReceiptRequestIntentBuilder.Response.PAYMENT);
String receiptDeliveryStatus = data.getStringExtra(SelectReceiptRequestIntentBuilder.Response.RECEIPT_DELIVERY_STATUS);
String receiptDeliveryType = data.getStringExtra(SelectReceiptRequestIntentBuilder.Response.RECEIPT_DELIVERY_TYPE);
String enteredReceiptValue = data.getStringExtra(SelectReceiptRequestIntentBuilder.Response.ENTERED_RECEIPT_VALUE);
} else {
// select receipt failed, check for error
String failureMessage = data.getStringExtra(SelectReceiptRequestIntentBuilder.Response.FAILURE_MESSAGE);
}
}
}
Updated about 1 month ago