Package-level declarations

Starting from June 2024, webhook messages from PortOne includes headers as specified in Standard Webhooks. This provides an easy way of securing webhook endpoints. Instead of relying on the IP addresses of the origin, the message itself can be verified. (i.e. It is NOT required to set up IP filters when the messages are verified by itself.)

The WebhookVerifier class implements a simple webhook verification logic. The WebhookVerificationException is thrown when the verification fails.

After a new webhook secret is issued to replace the existing secret, multiple signatures are included in the messages for a certain amount of time during which verifiers with either secret can verify the message. This grace period can be used to migrate your server to the new secret.

Types

Link copied to clipboard
@Serializable
@SerialName(value = "BillingKey.Deleted")
data class WebhookBillingKeyRequestDeleted(val timestamp: @Serializable(with = InstantSerializer::class) Instant, val data: WebhookBillingKeyRequestDeletedData) : WebhookRequest

빌링키가 삭제되었을 때

Link copied to clipboard
@Serializable
data class WebhookBillingKeyRequestDeletedData(val billingKey: String)
Link copied to clipboard
@Serializable
@SerialName(value = "BillingKey.Failed")
data class WebhookBillingKeyRequestFailed(val timestamp: @Serializable(with = InstantSerializer::class) Instant, val data: WebhookBillingKeyRequestFailedData) : WebhookRequest

빌링키 발급이 실패했을 때

Link copied to clipboard
@Serializable
data class WebhookBillingKeyRequestFailedData(val billingKey: String)
Link copied to clipboard
@Serializable
@SerialName(value = "BillingKey.Issued")
data class WebhookBillingKeyRequestIssued(val timestamp: @Serializable(with = InstantSerializer::class) Instant, val data: WebhookBillingKeyRequestIssuedData) : WebhookRequest

빌링키가 발급되었을 때

Link copied to clipboard
@Serializable
data class WebhookBillingKeyRequestIssuedData(val billingKey: String)
Link copied to clipboard
@Serializable
@SerialName(value = "BillingKey.Ready")
data class WebhookBillingKeyRequestReady(val timestamp: @Serializable(with = InstantSerializer::class) Instant, val data: WebhookBillingKeyRequestReadyData) : WebhookRequest

빌링키 발급창이 열렸을 때

Link copied to clipboard
@Serializable
data class WebhookBillingKeyRequestReadyData(val billingKey: String)
Link copied to clipboard
@Serializable
@SerialName(value = "BillingKey.Updated")
data class WebhookBillingKeyRequestUpdated(val timestamp: @Serializable(with = InstantSerializer::class) Instant, val data: WebhookBillingKeyRequestUpdatedData) : WebhookRequest

빌링키가 업데이트되었을 때

Link copied to clipboard
@Serializable
data class WebhookBillingKeyRequestUpdatedData(val billingKey: String)
Link copied to clipboard
@Serializable
sealed interface WebhookRequest

웹훅 형식

Link copied to clipboard
@Serializable
@SerialName(value = "Transaction.Cancelled")
data class WebhookTransactionRequestCancelled(val timestamp: @Serializable(with = InstantSerializer::class) Instant, val data: WebhookTransactionRequestCancelledData) : WebhookRequest

결제가 완전 취소되었을 때

Link copied to clipboard
@Serializable
data class WebhookTransactionRequestCancelledData(val paymentId: String, val transactionId: String, val cancellationId: String)
Link copied to clipboard
@Serializable
@SerialName(value = "Transaction.CancelPending")
data class WebhookTransactionRequestCancelPending(val timestamp: @Serializable(with = InstantSerializer::class) Instant, val data: WebhookTransactionRequestCancelPendingData) : WebhookRequest

(결제 취소가 비동기로 수행되는 경우) 결제 취소를 요청했을 때

@Serializable
data class WebhookTransactionRequestCancelPendingData(val paymentId: String, val transactionId: String)
Link copied to clipboard
@Serializable
@SerialName(value = "Transaction.Failed")
data class WebhookTransactionRequestFailed(val timestamp: @Serializable(with = InstantSerializer::class) Instant, val data: WebhookTransactionRequestFailedData) : WebhookRequest

결제(예약 결제 포함)가 실패했을 때

Link copied to clipboard
@Serializable
data class WebhookTransactionRequestFailedData(val paymentId: String, val transactionId: String)
Link copied to clipboard
@Serializable
@SerialName(value = "Transaction.Paid")
data class WebhookTransactionRequestPaid(val timestamp: @Serializable(with = InstantSerializer::class) Instant, val data: WebhookTransactionRequestPaidData) : WebhookRequest

결제(예약 결제 포함)가 승인되었을 때 (모든 결제 수단)

Link copied to clipboard
@Serializable
data class WebhookTransactionRequestPaidData(val paymentId: String, val transactionId: String)
@Serializable
@SerialName(value = "Transaction.PartialCancelled")
data class WebhookTransactionRequestPartialCancelled(val timestamp: @Serializable(with = InstantSerializer::class) Instant, val data: WebhookTransactionRequestPartialCancelledData) : WebhookRequest

결제가 부분 취소되었을 때

@Serializable
data class WebhookTransactionRequestPartialCancelledData(val paymentId: String, val transactionId: String, val cancellationId: String)
Link copied to clipboard
@Serializable
@SerialName(value = "Transaction.PayPending")
data class WebhookTransactionRequestPayPending(val timestamp: @Serializable(with = InstantSerializer::class) Instant, val data: WebhookTransactionRequestPayPendingData) : WebhookRequest

결제 승인 대기 상태가 되었을 때 (해외 결제시 발생 가능)

Link copied to clipboard
@Serializable
data class WebhookTransactionRequestPayPendingData(val paymentId: String, val transactionId: String)
Link copied to clipboard
@Serializable
@SerialName(value = "Transaction.Ready")
data class WebhookTransactionRequestReady(val timestamp: @Serializable(with = InstantSerializer::class) Instant, val data: WebhookTransactionRequestReadyData) : WebhookRequest

결제창이 열렸을 때

Link copied to clipboard
@Serializable
data class WebhookTransactionRequestReadyData(val paymentId: String, val transactionId: String)
@Serializable
@SerialName(value = "Transaction.VirtualAccountIssued")
data class WebhookTransactionRequestVirtualAccountIssued(val timestamp: @Serializable(with = InstantSerializer::class) Instant, val data: WebhookTransactionRequestVirtualAccountIssuedData) : WebhookRequest

가상계좌가 발급되었을 때

@Serializable
data class WebhookTransactionRequestVirtualAccountIssuedData(val paymentId: String, val transactionId: String)
Link copied to clipboard
data class WebhookUnknownRequest(val json: String)
Link copied to clipboard

Thrown to indicate that the webhook verification failed.

Link copied to clipboard

Verifies webhook messages as specified in Standard Webhooks.