com.tosspayments.paymentsdk.PaymentWidget.getSelectedPaymentMethod(): SelectedPaymentMethod
com.tosspayments.paymentsdk.model.PaymentWidgetStatusListener.onFail(fail: TossPaymentResult.Fail)
Parameter | Description |
---|---|
fail | 에러 정보 |
com.tosspayments.paymentsdk.PaymentWidget.renderPaymentMethods(com.tosspayments.paymentsdk.view.PaymentMethod, com.tosspayments.paymentsdk.view.PaymentMethod.Rendering.Amount, com.tosspayments.paymentsdk.view.PaymentMethod.Rendering.Options, com.tosspayments.paymentsdk.model.PaymentWidgetStatusListener)
com.tosspayments.paymentsdk.model.PaymentWidgetStatusListener
com.tosspayments.paymentsdk.PaymentWidget.renderPaymentMethods(method: PaymentMethod,amount: Number)
Parameter | Description |
---|---|
method | 결제 수단 위젯 |
amount | 결제 결제금액 |
com. tosspayments.paymentsdk.PaymentWidget.requestPayment(paymentInfo: PaymentMethod.PaymentInfo, paymentCallback: PaymentCallback)
Parameter | Description |
---|---|
paymentInfo | 결제 정보 |
paymentCallback | 결제 결과 수신 Callback |
com. tosspayments.paymentsdk.PaymentWidget.updateAmount(amount: Number, description: String?)
Parameter | Description |
---|---|
amount | 결제 금액 |
description | 결제 금액이 변경된 사유. 결제 전환율 개선을 위한 리포트 및 A/B 테스트 분석에 사용. 쿠폰와 같은 형식 |
com.tosspayments.paymentsdk.PaymentWidget.addPaymentMethodEventListener(listener: PaymentMethodEventListener)
Parameter | Description |
---|---|
listener | customRequest, customPaymentMethodSelect, customPaymentMethodUnselect 이벤트 수신 리스너 |
com.tosspayments.paymentsdk.PaymentWidget.renderAgreement(agreement: Agreement)
Parameter | Description |
---|---|
agreement | 이용약관 위젯 |
com.tosspayments.paymentsdk.PaymentWidget.addAgreementStatusListener(listener: AgreementStatusListener)
Parameter | Description |
---|---|
listener | 이용약관 상태 변경 수신 리스너 |
- PaymentMethodWidget -> PaymentMethod
- onActivityResult, ActivityResultLauncher를 통한 Callback -> PaymentCallback으로부터 수신
PAYMENT_WIDGET.requestPayment(
paymentInfo = PaymentMethod.PaymentInfo(orderId = ORDER_ID, orderName = ORDER_NAME),
paymentCallback = object : PaymentCallback {
override fun onPaymentSuccess(success: TossPaymentResult.Success) {
handlePaymentSuccessResult(success)
}
override fun onPaymentFailed(fail: TossPaymentResult.Fail) {
handlePaymentFailResult(fail)
}
}
)
- com.tosspayments.paymentsdk.PaymentWidget.setMethodWidget
- com.tosspayments.paymentsdk.PaymentWidget.renderPaymentMethodWidget
- com.tosspayments.paymentsdk.PaymentWidget.requestPayment( androidx.activity.result.ActivityResultLauncher<android.content.Intent>, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
- 생성 시점 : onStart 호출 이전
- arguments : activity(필수), options(옵션, BrandPay 위젯 렌더링시 사용) 추가.
private lateinit var paymentWidget: PaymentWidget
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
...
paymentWidget = PaymentWidget(
activity = APPCOMPAT_ACTIVITY,
clientKey = CLIENT_KEY,
customerKey = CUSTOMER_KEY,
options = PaymentWidgetOptions.Builder()
.brandPayOption(redirectUrl = REDIRECT_URL)
.build()
)
}
class | PaymentWidgetOptions.Builder | PaymentWidgetOptions 객체를 생성하기 위한 Builder 클래스 |
---|
PaymentWidgetOptions.Builder | PaymentWidgetOptions.Builder() | 생성자 |
---|---|---|
PaymentWidgetOptions.Builder | brandPayOption(redirectUrl: String) | 브랜드 페이 위젯 렌더링 및 결제를 위한 url |
PaymentWidgetOptions | build() | PaymentWidgetOptions 객체 생성 |