Documentation
¶
Index ¶
- Constants
- Variables
- func ConfirmWebhook(webhookUrl string) (string, error)
- func CreateSignatureFromObj(obj interface{}, key string) (string, error)
- func CreateSignatureOfPaymentRequest(data CheckoutRequestType, key string) (string, error)
- func Key(clientId string, apiKey string, checksumKey string, partnerCode ...string) error
- func SortObjByKey(obj interface{}) (string, error)
- type CancelPaymentLinkRequestType
- type CheckoutRequestType
- type CheckoutResponseDataType
- type ConfirmWebhookRequestType
- type Item
- type PayOSError
- type PayOSResponseType
- type PaymentLinkDataType
- type TransactionType
- type WebhookDataType
- type WebhookType
Constants ¶
View Source
const ( NoSignatureErrorMessage = "No signature." NoDataErrorMessage = "No data." InvalidSignatureErrorMessage = "Invalid signature." DataNotIntegrityErrorMessage = "The data is unreliable because the signature of the response does not match the signature of the data." WebhookURLInvalidErrorMessage = "Webhook URL invalid." InternalServerErrorErrorMessage = "Internal Server Error." InvalidParameterErrorMessage = "Invalid Parameter." OrderCodeOuOfRange = "orderCode is out of range." )
View Source
const ( InternalServerErrorErrorCode = "20" InvalidParameterErrorCode = "21" NoSignatureErrorCode = "22" NoDataErrorCode = "23" InvalidSignatureErrorCode = "24" DataNotIntegrityErrorCode = "25" WebhookURLInvalidErrorCode = "26" )
View Source
const PayOSBaseUrl = "https://api-merchant.payos.vn"
Variables ¶
View Source
var PayOSApiKey string
View Source
var PayOSChecksumKey string
View Source
var PayOSClientId string
View Source
var PayOSPartnerCode string
Functions ¶
func ConfirmWebhook ¶ added in v1.0.0
Validate the Webhook URL of a payment channel and add or update the Webhook URL for that Payment Channel if successful
func CreateSignatureFromObj ¶ added in v1.0.0
func CreateSignatureOfPaymentRequest ¶ added in v1.0.0
func CreateSignatureOfPaymentRequest(data CheckoutRequestType, key string) (string, error)
func SortObjByKey ¶ added in v1.0.0
Types ¶
type CancelPaymentLinkRequestType ¶ added in v1.0.0
type CancelPaymentLinkRequestType struct {
CancellationReason *string `json:"cancellationReason"`
}
type CheckoutRequestType ¶ added in v1.0.0
type CheckoutRequestType struct { OrderCode int64 `json:"orderCode"` Amount int `json:"amount"` Description string `json:"description"` CancelUrl string `json:"cancelUrl"` ReturnUrl string `json:"returnUrl"` Signature *string `json:"signature"` Items []Item `json:"items"` BuyerName *string `json:"buyerName"` BuyerEmail *string `json:"buyerEmail"` BuyerPhone *string `json:"buyerPhone"` BuyerAddress *string `json:"buyerAddress"` ExpiredAt *int `json:"expiredAt"` }
type CheckoutResponseDataType ¶ added in v1.0.0
type CheckoutResponseDataType struct { Bin string `json:"bin"` AccountNumber string `json:"accountNumber"` AccountName string `json:"accountName"` Amount int `json:"amount"` Description string `json:"description"` OrderCode int64 `json:"orderCode"` Currency string `json:"currency"` PaymentLinkId string `json:"paymentLinkId"` Status string `json:"status"` CheckoutUrl string `json:"checkoutUrl"` QRCode string `json:"qrCode"` ExpiredAt *int `json:"expiredAt"` }
func CreatePaymentLink ¶ added in v1.0.0
func CreatePaymentLink(paymentData CheckoutRequestType) (*CheckoutResponseDataType, error)
Create a payment link for the order data passed in the parameter
type ConfirmWebhookRequestType ¶ added in v1.0.0
type ConfirmWebhookRequestType struct {
WebhookUrl string `json:"webhookUrl"`
}
type PayOSError ¶ added in v1.0.0
type PayOSError struct {
// contains filtered or unexported fields
}
func NewPayOSError ¶ added in v1.0.0
func NewPayOSError(code, message string) *PayOSError
func (*PayOSError) Error ¶ added in v1.0.0
func (e *PayOSError) Error() string
type PayOSResponseType ¶ added in v1.0.0
type PaymentLinkDataType ¶ added in v1.0.0
type PaymentLinkDataType struct { Id string `json:"id"` OrderCode int64 `json:"orderCode"` Amount int `json:"amount"` AmountPaid int `json:"amountPaid"` AmountRemaining int `json:"amountRemaining"` Status string `json:"status"` CreateAt string `json:"createAt"` Transactions []TransactionType `json:"transactions"` CancellationReason *string `json:"cancellationReason"` CancelAt *string `json:"cancelAt"` }
func CancelPaymentLink ¶ added in v1.0.0
func CancelPaymentLink(orderCode string, cancellationReason *string) (*PaymentLinkDataType, error)
Cancel the payment link of the order
func GetPaymentLinkInformation ¶ added in v1.0.0
func GetPaymentLinkInformation(orderCode string) (*PaymentLinkDataType, error)
Get payment information of an order that has created a payment link
type TransactionType ¶ added in v1.0.0
type TransactionType struct { Reference string `json:"reference"` Amount int `json:"amount"` AccountNumber string `json:"accountNumber"` Description string `json:"description"` TransactionDateTime string `json:"transactionDateTime"` VirtualAccountName *string `json:"virtualAccountName"` VirtualAccountNumber *string `json:"virtualAccountNumber"` CounterAccountBankId *string `json:"counterAccountBankId"` CounterAccountBankName *string `json:"counterAccountBankName"` CounterAccountName *string `json:"counterAccountName"` CounterAccountNumber *string `json:"counterAccountNumber"` }
type WebhookDataType ¶ added in v1.0.0
type WebhookDataType struct { OrderCode int64 `json:"orderCode"` Amount int `json:"amount"` Description string `json:"description"` AccountNumber string `json:"accountNumber"` Reference string `json:"reference"` TransactionDateTime string `json:"transactionDateTime"` Currency string `json:"currency"` PaymentLinkId string `json:"paymentLinkId"` Code string `json:"code"` Desc string `json:"desc"` CounterAccountBankId *string `json:"counterAccountBankId"` CounterAccountBankName *string `json:"counterAccountBankName"` CounterAccountName *string `json:"counterAccountName"` CounterAccountNumber *string `json:"counterAccountNumber"` VirtualAccountName *string `json:"virtualAccountName"` VirtualAccountNumber *string `json:"virtualAccountNumber"` }
func VerifyPaymentWebhookData ¶ added in v1.0.0
func VerifyPaymentWebhookData(webhookBody WebhookType) (*WebhookDataType, error)
Verify data received via webhook after payment
type WebhookType ¶ added in v1.0.0
type WebhookType struct { Code string `json:"code"` Desc string `json:"desc"` Success bool `json:"success"` Data *WebhookDataType `json:"data"` Signature string `json:"signature"` }
Click to show internal directories.
Click to hide internal directories.