Documentation ¶
Index ¶
- Constants
- type Client
- func (client *Client) PaymentsCapture(ctx context.Context, transactionId int64, request *PaymentsCaptureRequest) (response *PaymentsCaptureResponse, err error)
- func (client *Client) PaymentsConfirm(ctx context.Context, transactionId int64, request *PaymentsConfirmRequest) (response *PaymentsConfirmResponse, err error)
- func (client *Client) PaymentsDetails(ctx context.Context, request *PaymentsDetailsRequest) (response *PaymentsDetailsResponse, err error)
- func (client *Client) PaymentsRequest(ctx context.Context, request *PaymentsRequest) (response *PaymentsResponse, err error)
- type ClientOpts
- type PaymentsCaptureRequest
- type PaymentsCaptureResponse
- type PaymentsConfirmInfoPackagesResponse
- type PaymentsConfirmInfoPayInfoResponse
- type PaymentsConfirmInfoResponse
- type PaymentsConfirmInfoShippingAddressRecipientResponse
- type PaymentsConfirmInfoShippingAddressResponse
- type PaymentsConfirmInfoShippingResponse
- type PaymentsConfirmRequest
- type PaymentsConfirmResponse
- type PaymentsDetailsInfoPackagesProductsResponse
- type PaymentsDetailsInfoPackagesResponse
- type PaymentsDetailsInfoPayInfoResponse
- type PaymentsDetailsInfoRefundListResponse
- type PaymentsDetailsInfoResponse
- type PaymentsDetailsInfoShippingAddressRecipientResponse
- type PaymentsDetailsInfoShippingAddressResponse
- type PaymentsDetailsInfoShippingResponse
- type PaymentsDetailsRequest
- type PaymentsDetailsResponse
- type PaymentsInfoPaymentURLResponse
- type PaymentsInfoResponse
- type PaymentsOptionsDisplayRequest
- type PaymentsOptionsExtraRequest
- type PaymentsOptionsFamilyServiceAddFriendsRequest
- type PaymentsOptionsFamilyServiceRequest
- type PaymentsOptionsPaymentRequest
- type PaymentsOptionsRequest
- type PaymentsOptionsShippingAddressRecipientRequest
- type PaymentsOptionsShippingAddressRequest
- type PaymentsOptionsShippingRequest
- type PaymentsPackageProductRequest
- type PaymentsPackageRequest
- type PaymentsRedirectUrlsRequest
- type PaymentsRequest
- type PaymentsResponse
- type Signer
Constants ¶
const ( APIHostSandbox = "https://sandbox-api-pay.line.me" APIHostProduction = "https://api-pay.line.me" )
const ( PaymentsDetailsFieldsTransaction string = "RANSACTION" PaymentsDetailsFieldsOrder string = "ORDER" PaymentsDetailsFieldsDefault string = "ALL" )
const ( PaymentsConfirmUrlTypeClient string = "CLIENT" PaymentsConfirmUrlTypeServer string = "SERVER" PaymentsConfirmUrlTypeNone string = "NONE" )
const (
ApiReturnCodeSuccess string = "0000"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(channelID, channelSecret string, signer *Signer, opts *ClientOpts) (*Client, error)
func (*Client) PaymentsCapture ¶
func (client *Client) PaymentsCapture(ctx context.Context, transactionId int64, request *PaymentsCaptureRequest) (response *PaymentsCaptureResponse, err error)
PaymentsCapture Transactions that have set options.payment.capture as false when requesting the Request API payment will be put on hold when the payment is completed with the Confirm API. In order to finalize the payment, an additional purchase with Capture API is required.
func (*Client) PaymentsConfirm ¶
func (client *Client) PaymentsConfirm(ctx context.Context, transactionId int64, request *PaymentsConfirmRequest) (response *PaymentsConfirmResponse, err error)
func (*Client) PaymentsDetails ¶
func (client *Client) PaymentsDetails(ctx context.Context, request *PaymentsDetailsRequest) (response *PaymentsDetailsResponse, err error)
PaymentsDetails
func (*Client) PaymentsRequest ¶
func (client *Client) PaymentsRequest(ctx context.Context, request *PaymentsRequest) (response *PaymentsResponse, err error)
type ClientOpts ¶
type ClientOpts struct {
ProductionEnabled bool
}
type PaymentsCaptureRequest ¶
type PaymentsCaptureRequest struct { Amount int `json:"amount"` Currency string `json:"currency"` // USD, JPY, TWD, THB }
PaymentsCaptureRequest request body of capture api
type PaymentsCaptureResponse ¶
type PaymentsCaptureResponse struct { ReturnCode string `json:"returnCode"` ReturnMessage string `json:"returnMessage"` Info struct { TransactionID int64 `json:"transactionId"` OrderID string `json:"orderId"` PayInfo []struct { Method string `json:"method"` Amount int `json:"amount"` } `json:"payInfo"` } `json:"info"` }
PaymentsCaptureResponse response body of capture api `info[].payInfo[].method`: CREDIT_CARD, BALANCE, DISCOUNT
type PaymentsConfirmInfoPayInfoResponse ¶
type PaymentsConfirmInfoPayInfoResponse struct { Method string `json:"method"` Amount int `json:"amount"` CreditCardNickname string `json:"creditCardNickname"` CreditCardBrand string `json:"creditCardBrand"` // VISA, MASTER, AMEX, DINERS, JCB MaskedCreditCardNumber string `json:"maskedCreditCardNumber"` // Format: **** **** **** 1234 }
type PaymentsConfirmInfoResponse ¶
type PaymentsConfirmInfoResponse struct { OrderID string `json:"orderId"` TransactionID int64 `json:"transactionId"` AuthorizationExpireDate time.Time `json:"authorizationExpireDate"` RegKey string `json:"regKey"` PayInfo []PaymentsConfirmInfoPayInfoResponse `json:"payInfo"` Packages []PaymentsConfirmInfoPackagesResponse `json:"packages"` Shipping PaymentsConfirmInfoShippingResponse `json:"shipping"` }
type PaymentsConfirmInfoShippingAddressResponse ¶
type PaymentsConfirmInfoShippingAddressResponse struct { Country string `json:"country,omitempty"` PostalCode string `json:"postalCode,omitempty"` State string `json:"state,omitempty"` City string `json:"city,omitempty"` Detail string `json:"detail,omitempty"` Optional string `json:"optional,omitempty"` Recipient PaymentsConfirmInfoShippingAddressRecipientResponse `json:"recipient,omitempty"` }
type PaymentsConfirmInfoShippingResponse ¶
type PaymentsConfirmInfoShippingResponse struct { MethodID string `json:"methodId"` FeeAmount int `json:"feeAmount"` Address PaymentsConfirmInfoShippingAddressResponse `json:"address"` }
type PaymentsConfirmRequest ¶
Amount: [form.amount != sum(packages[].amount) + sum(packages[].userFee) + shippingFee]
type PaymentsConfirmResponse ¶
type PaymentsConfirmResponse struct { ReturnCode string `json:"returnCode"` ReturnMessage string `json:"returnMessage"` Info PaymentsConfirmInfoResponse `json:"info"` Amount int `json:"amount"` Currency string `json:"currency"` }
type PaymentsDetailsInfoPackagesResponse ¶
type PaymentsDetailsInfoPackagesResponse struct { ID string `json:"id"` Amount int `json:"amount"` UserFeeAmount int `json:"userFeeAmount"` Name string `json:"name"` Products []PaymentsDetailsInfoPackagesProductsResponse `json:"products"` }
type PaymentsDetailsInfoResponse ¶
type PaymentsDetailsInfoResponse struct { TransactionID int64 `json:"transactionId"` TransactionDate time.Time `json:"transactionDate"` TransactionType string `json:"transactionType"` PayStatus string `json:"payStatus"` // AUTHORIZATION, VOIDED_AUTHORIZATION, EXPIRED_AUTHORIZATION ProductName string `json:"productName"` MerchantName string `json:"merchantName"` Currency string `json:"currency"` AuthorizationExpireDate time.Time `json:"authorizationExpireDate"` PayInfo []PaymentsDetailsInfoPayInfoResponse `json:"payInfo"` RefundList []PaymentsDetailsInfoRefundListResponse `json:"refundList"` // in case of `Transaction` type OriginalTransactionID int64 `json:"originalTransactionId"` Packages []PaymentsDetailsInfoPackagesResponse `json:"packages"` Shipping PaymentsDetailsInfoShippingResponse `json:"shipping"` }
type PaymentsDetailsInfoShippingAddressResponse ¶
type PaymentsDetailsInfoShippingAddressResponse struct { Country string `json:"country"` PostalCode string `json:"postalCode"` State string `json:"state"` City string `json:"city"` Detail string `json:"detail"` Optional string `json:"optional"` Recipient PaymentsDetailsInfoShippingAddressRecipientResponse `json:"recipient"` }
type PaymentsDetailsInfoShippingResponse ¶
type PaymentsDetailsInfoShippingResponse struct { MethodID string `json:"methodId"` FeeAmount int `json:"feeAmount"` Address PaymentsDetailsInfoShippingAddressResponse `json:"address"` }
type PaymentsDetailsRequest ¶
type PaymentsDetailsRequest struct { TransactionIDs []int64 `` OrderIDs []string `` Fields string `` }
if assign `TransactionIDs` and `OrderIDs` both at the same time, they should mean for the same record (like `AND` query).
type PaymentsDetailsResponse ¶
type PaymentsDetailsResponse struct { ReturnCode string `json:"returnCode"` ReturnMessage string `json:"returnMessage"` Info []PaymentsDetailsInfoResponse `json:"info"` }
type PaymentsInfoResponse ¶
type PaymentsInfoResponse struct { TransactionID int64 `json:"transactionId"` PaymentAccessToken string `json:"paymentAccessToken"` PaymentURL PaymentsInfoPaymentURLResponse `json:"paymentUrl"` }
type PaymentsOptionsFamilyServiceRequest ¶
type PaymentsOptionsFamilyServiceRequest struct {
AddFriends []PaymentsOptionsFamilyServiceAddFriendsRequest `json:"addFriends"`
}
type PaymentsOptionsRequest ¶
type PaymentsOptionsRequest struct { Payment PaymentsOptionsPaymentRequest `json:"payment"` Display PaymentsOptionsDisplayRequest `json:"display"` Shipping PaymentsOptionsShippingRequest `json:"shipping"` FamilyService PaymentsOptionsFamilyServiceRequest `json:"familyService"` Extra PaymentsOptionsExtraRequest `json:"extra"` }
type PaymentsOptionsShippingAddressRecipientRequest ¶
type PaymentsOptionsShippingAddressRecipientRequest struct { FirstName string `json:"firstName,omitempty"` LastName string `json:"lastName,omitempty"` FirstNameOptional string `json:"firstNameOptional,omitempty"` LastNameOptional string `json:"lastNameOptional,omitempty"` Email string `json:"email,omitempty"` PhoneNo string `json:"phoneNo,omitempty"` }
type PaymentsOptionsShippingAddressRequest ¶
type PaymentsOptionsShippingAddressRequest struct { Country string `json:"country,omitempty"` PostalCode string `json:"postalCode,omitempty"` State string `json:"state,omitempty"` City string `json:"city,omitempty"` Detail string `json:"detail,omitempty"` Optional string `json:"optional,omitempty"` Recipient PaymentsOptionsShippingAddressRecipientRequest `json:"recipient,omitempty"` }
type PaymentsOptionsShippingRequest ¶
type PaymentsOptionsShippingRequest struct { ShippintType string `json:"type,omitempty"` // NO_SHIPPING, FIXED_ADDRESS, SHIPPING FeeAmount string `json:"feeAmount,omitempty"` //why string? FeeInquiryURL string `json:"feeInquiryUrl,omitempty"` FeeInquiryType string `json:"feeInquiryType,omitempty"` // CONDITION, FIXED Address PaymentsOptionsShippingAddressRequest `json:"address"` }
type PaymentsPackageProductRequest ¶
type PaymentsPackageProductRequest struct { ID string `json:"id,omitempty"` Name string `json:"name"` ImageURL string `json:"imageUrl,omitempty"` Quantity int `json:"quantity"` Price int `json:"price"` OriginalPrice int `json:"originalPrice,omitempty"` }
`Name` required `Quantity` required `Price` required
type PaymentsPackageRequest ¶
type PaymentsPackageRequest struct { ID string `json:"id"` Amount int `json:"amount"` UserFee int `json:"userFee,omitempty"` Name string `json:"name"` Products []PaymentsPackageProductRequest `json:"products"` }
`Id` required `Amount` required, valid amount `packages[].amount != sum(packages[].products[].quantity * packages[].products[].price)` `Name` required
type PaymentsRedirectUrlsRequest ¶
type PaymentsRedirectUrlsRequest struct { AppPackageName string `json:"appPackageName,omitempty"` ConfirmURL string `json:"confirmUrl"` ConfirmURLType string `json:"confirmUrlType,omitempty"` CancelURL string `json:"cancelUrl"` }
NOTE: for the behavior of `ConfirmUrl`, when `ConfirmUrlType` set to `PaymentsConfirmUrlTypeClient`, LINE server will send user to the `ConfirmUrl` with `transactionId`. `orderID` won't send for this case. the exception is, when user use *QR scanner* at the `waitPreLogin` page (login by LINE account or QR Code scan page) server will send user to `ConfirmUrl` with `orderID` `ConfirmUrl` required `CancelUrl` required
type PaymentsRequest ¶
type PaymentsRequest struct { Amount int `json:"amount"` Currency string `json:"currency"` OrderID string `json:"orderId"` Packages []PaymentsPackageRequest `json:"packages"` RedirectUrls PaymentsRedirectUrlsRequest `json:"redirectUrls"` Options PaymentsOptionsRequest `json:"options"` }
`Amount` required, valid amount `form.amount != sum(packages[].amount) + sum(packages[].userFee) + shippingFee` `Currency` required, is ISO 4217, supported: USD, JPY, TWD, THB `OrderId` required if `Capture` true: only need to call `Confirm API` to process payments. false: call `Confirm API` and then `Capture API`
type PaymentsResponse ¶
type PaymentsResponse struct { ReturnCode string `json:"returnCode"` ReturnMessage string `json:"returnMessage"` Info PaymentsInfoResponse `json:"info"` }
response
type Signer ¶
type Signer struct {
ChannelId string
}
func (Signer) SignWithBody ¶
func (v3 Signer) SignWithBody(r *http.Request, channelSecret string, requestBody string) (header http.Header, err error)
SignWithBody implements API Authentication in `https://pay.line.me/developers/apis/onlineApis` HTTP Method : POST Signature = Base64(HMAC-SHA256(Your ChannelSecret, (Your ChannelSecret + URL Path + RequestBody + nonce)))
HTTP Method : GET Signature = Base64(HMAC-SHA256(Your ChannelSecret, (Your ChannelSecret + URL Path + Query String + nonce))) Query String : A query string except ? (Example: Name1=Value1&Name2=Value2...)