Interface PaymentManager.CustomSheetTransactionInfoListener
- Enclosing class:
- PaymentManager
public static interface PaymentManager.CustomSheetTransactionInfoListener
This interface is for listening callback events of online (in-app) custom sheet payment.
This is invoked when card is changed by the user on the custom payment sheet, and also with the success or failure of online (in-app) payment.
This listener is registered when
Caution: AmountBoxControl must be returned in onCardInfoUpdated() on SheetUpdatedListener to remove progress bar on custom payment sheet.
This is invoked when card is changed by the user on the custom payment sheet, and also with the success or failure of online (in-app) payment.
This listener is registered when
PaymentManager.startInAppPayWithCustomSheet(CustomSheetPaymentInfo, CustomSheetTransactionInfoListener)
API is called.Caution: AmountBoxControl must be returned in onCardInfoUpdated() on SheetUpdatedListener to remove progress bar on custom payment sheet.
private final PaymentManager.CustomSheetTransactionInfoListener mTransactionListener2
= new PaymentManager.CustomSheetTransactionInfoListener() {
@Override
public void onCardInfoUpdated(CardInfo selectedCardInfo, CustomSheet sheet) {
// Update amount if needs.
double upatedItem = 3000;
// Update AmountBoxControl.
AmountBoxControl amountBoxControl = (AmountBoxControl) sheet.getSheetControl("id_amount");
double item = upatedItem;
double tax = amountBoxControl.getValue("id_tax");
double shipping = amountBoxControl.getValue("id_shipping");
double total = item + tax + shipping;
amountBoxControl.updateValue("id_item", item);
amountBoxControl.updateValue("id_tax", tax);
amountBoxControl.setAmountTotal(total, AmountConstants.FORMAT_TOTAL_PRICE_ONLY);
sheet.updateControl(amountBoxControl);
// Call updateSheet() API method with AmountBoxControl. This is mandatory.
paymentManager.updateSheet(sheet);
}
@Override
public void onSuccess(CustomSheetPaymentInfo response, String paymentCredential,
Bundle extraPaymentData) {
Log.d(TAG, "Transaction : Succeeded");
}
@Override
public void onFailure(int errorCode, Bundle errorData) {
Log.d(TAG, "Transaction : Failed" + errorCode + "/" + errorData);
}
}
- Since:
- API Level 1.3
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
onCardInfoUpdated
(CardInfo selectedCardInfo, CustomSheet sheet) This callback is received when the user changes card on the custom payment sheet in Samsung Pay.
In this callback, updateSheet() method must be called to update current payment sheet.void
onFailure
(int errCode, android.os.Bundle errorData) This callback is received when the online payment transaction has failed.void
onSuccess
(CustomSheetPaymentInfo customSheetPaymentInfo, String paymentCredential, android.os.Bundle extraPaymentData) This callback is received when the online (in-app) payment transaction is approved by user and able to successfully generate in-app payload.
-
Method Details
-
onCardInfoUpdated
This callback is received when the user changes card on the custom payment sheet in Samsung Pay.
In this callback, updateSheet() method must be called to update current payment sheet.- Parameters:
selectedCardInfo
- Currently selected card's information.- Since:
- API Level 1.3
- See Also:
-
onSuccess
void onSuccess(CustomSheetPaymentInfo customSheetPaymentInfo, String paymentCredential, android.os.Bundle extraPaymentData) This callback is received when the online (in-app) payment transaction is approved by user and able to successfully generate in-app payload. The payload could be an encrypted cryptogram (direct in-app payment) or Payment Gateway's token reference ID (indirect in-app payment).- Parameters:
customSheetPaymentInfo
- Online payment information from Samsung Pay.
Since API level 1.5,SpaySdk.EXTRA_LAST4_FPAN
andSpaySdk.EXTRA_LAST4_DPAN
of the card which was used for the current transaction is included in CardInfo.paymentCredential
- Payment Credentials. Example: Cryptogram, AID (direct in-app payment), or tokenRefId (indirect in-app payment).extraPaymentData
- Additional payment credentials if any.- Since:
- API Level 1.3
-
onFailure
void onFailure(int errCode, android.os.Bundle errorData) This callback is received when the online payment transaction has failed.- Parameters:
errCode
- The result code of error cause.errorData
- Extra error message data, if any, provided by Samsung Pay.
Note: Please referSpaySdk.COMMON_STATUS_TABLE
in detail.
- Since:
- API Level 1.3
-
Samsung Electronics.
Samsung Pay SDK 2.19.00 - Jun 12 2024