Documentation ¶
Index ¶
- Constants
- func Bool(v bool) *bool
- func Int(v int) *int
- func Int64(v int64) *int64
- func MustParseInt64(v string) int64
- func ParseInt64(v string) (int64, error)
- func String(v string) *string
- type CaptureRequest
- type CaptureResponse
- type CheckPaymentStatusRequest
- type CheckPaymentStatusResponse
- type CheckRegKeyRequest
- type CheckRegKeyResponse
- type Client
- func (c *Client) Capture(ctx context.Context, transactionID int64, req *CaptureRequest) (*CaptureResponse, *http.Response, error)
- func (c *Client) CheckPaymentStatus(ctx context.Context, transactionID int64, req *CheckPaymentStatusRequest) (*CheckPaymentStatusResponse, *http.Response, error)
- func (c *Client) CheckRegKey(ctx context.Context, regKey string, req *CheckRegKeyRequest) (*CheckRegKeyResponse, *http.Response, error)
- func (c *Client) Confirm(ctx context.Context, transactionID int64, req *ConfirmRequest) (*ConfirmResponse, *http.Response, error)
- func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*http.Response, error)
- func (c *Client) ExpireRegKey(ctx context.Context, regKey string, req *ExpireRegKeyRequest) (*ExpireRegKeyResponse, *http.Response, error)
- func (c *Client) NewRequest(method, path string, body interface{}) (*http.Request, error)
- func (c *Client) PayPreapproved(ctx context.Context, regKey string, req *PayPreapprovedRequest) (*PayPreapprovedResponse, *http.Response, error)
- func (c *Client) PaymentDetails(ctx context.Context, req *PaymentDetailsRequest) (*PaymentDetailsResponse, *http.Response, error)
- func (c *Client) Refund(ctx context.Context, transactionID int64, req *RefundRequest) (*RefundResponse, *http.Response, error)
- func (c *Client) Request(ctx context.Context, req *RequestRequest) (*RequestResponse, *http.Response, error)
- func (c *Client) Void(ctx context.Context, transactionID int64, req *VoidRequest) (*VoidResponse, *http.Response, error)
- type ClientOption
- type ConfirmRequest
- type ConfirmResponse
- type ExpireRegKeyRequest
- type ExpireRegKeyResponse
- type PayPreapprovedRequest
- type PayPreapprovedResponse
- type PaymentDetailsRequest
- type PaymentDetailsResponse
- type RefundRequest
- type RefundResponse
- type RequestOptions
- type RequestOptionsDisplay
- type RequestOptionsExtras
- type RequestOptionsPayment
- type RequestOptionsShipping
- type RequestPackage
- type RequestPackageProduct
- type RequestRedirectURLs
- type RequestRequest
- type RequestResponse
- type VoidRequest
- type VoidResponse
Constants ¶
const ( APIEndpointReal = "https://api-pay.line.me" APIEndpointSandbox = "https://sandbox-api-pay.line.me" )
API endpoint base constants
Variables ¶
This section is empty.
Functions ¶
func MustParseInt64 ¶
MustParseInt64 string to int64 without error function
Types ¶
type CaptureRequest ¶
CaptureRequest type
type CaptureResponse ¶
type CaptureResponse 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"` }
CaptureResponse type
type CheckPaymentStatusRequest ¶
type CheckPaymentStatusRequest struct { }
CheckPaymentStatusRequest type
type CheckPaymentStatusResponse ¶
type CheckPaymentStatusResponse struct { ReturnCode string `json:"returnCode"` ReturnMessage string `json:"returnMessage"` }
CheckPaymentStatusResponse type
type CheckRegKeyRequest ¶
type CheckRegKeyRequest struct {
CreditCardAuth *bool `url:"creditCardAuth,omitempty"`
}
CheckRegKeyRequest type
type CheckRegKeyResponse ¶
type CheckRegKeyResponse struct { ReturnCode string `json:"returnCode"` ReturnMessage string `json:"returnMessage"` }
CheckRegKeyResponse type
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client type
func New ¶
func New(channelID, channelSecret string, options ...ClientOption) (*Client, error)
New returns a new pay client instance.
func (*Client) Capture ¶
func (c *Client) Capture(ctx context.Context, transactionID int64, req *CaptureRequest) (*CaptureResponse, *http.Response, error)
Capture method Request APIを使って決済をリクエストする際に"options.payment.capture"をfalseに設定した場合、Confirm APIで決済を完了させると決済ステータスは売上確定待ち状態になります。 決済を完全に確定するためには、Capture APIを呼び出して売上確定を行う必要があります。
func (*Client) CheckPaymentStatus ¶
func (c *Client) CheckPaymentStatus(ctx context.Context, transactionID int64, req *CheckPaymentStatusRequest) (*CheckPaymentStatusResponse, *http.Response, error)
CheckPaymentStatus method LINE Pay でのオーソリ履歴の内訳を照会する API です。オーソリ済み、またはオーソリ無効処理データのみ照会できます。売上が確 定されたデータは「決済内訳照会 API」で照会できます。
func (*Client) CheckRegKey ¶
func (c *Client) CheckRegKey(ctx context.Context, regKey string, req *CheckRegKeyRequest) (*CheckRegKeyResponse, *http.Response, error)
CheckRegKey method 継続決済 API を使用する前に、regKey が使用可能な状態であるかどうかを確認します。
func (*Client) Confirm ¶
func (c *Client) Confirm(ctx context.Context, transactionID int64, req *ConfirmRequest) (*ConfirmResponse, *http.Response, error)
Confirm method confirmUrlまたはCheck Payment Status APIによってユーザーが決済要求を承認した後、加盟店側で決済を完了させるためのAPIです。 Request APIの"options.payment.capture"をfalseに設定するとオーソリと売上確定が分離された決済になり、決済を完了させても決済ステータスは売上確定待ち(オーソリ)状態のままとなります。 売上を確定するには、Capture APIを呼び出して売上確定を行う必要があります。
func (*Client) ExpireRegKey ¶
func (c *Client) ExpireRegKey(ctx context.Context, regKey string, req *ExpireRegKeyRequest) (*ExpireRegKeyResponse, *http.Response, error)
ExpireRegKey method 継続決済で登録された regKey 情報を満了させる API です。 この API を呼び出した以降は、当該の regKey では継続決済することができなくなります。
func (*Client) NewRequest ¶
NewRequest method
func (*Client) PayPreapproved ¶
func (c *Client) PayPreapproved(ctx context.Context, regKey string, req *PayPreapprovedRequest) (*PayPreapprovedResponse, *http.Response, error)
PayPreapproved method 決済 reserve API で決済タイプ(type)が PREAPPROVED で決済された場合、決済結果の受信時に regKey を受け取ります。 継続決済 API は、この regKey を利用し LINE アプリを介さずに直接決済する際に使用します。
func (*Client) PaymentDetails ¶
func (c *Client) PaymentDetails(ctx context.Context, req *PaymentDetailsRequest) (*PaymentDetailsResponse, *http.Response, error)
PaymentDetails method LINE Payの取引履歴を照会するAPIです。オーソリと売上確定の取引を照会できます。 "fields"を設定することで、取引情報または注文情報を選択的に照会することができます。
func (*Client) Refund ¶
func (c *Client) Refund(ctx context.Context, transactionID int64, req *RefundRequest) (*RefundResponse, *http.Response, error)
Refund method 決済完了(売上確定済み)された取引を返金します。 返金時は、LINE Payユーザーの決済取引番号を必ず渡す必要があります。一部返金も可能です。
func (*Client) Request ¶
func (c *Client) Request(ctx context.Context, req *RequestRequest) (*RequestResponse, *http.Response, error)
Request method LINE Pay決済をリクエストします。このとき、ユーザーの注文情報と決済手段を設定できます。 リクエストに成功するとLINE Pay取引番号が発行されます。この取引番号を利用して、決済完了・返金を行うことができます。
type ClientOption ¶
ClientOption type
type ConfirmRequest ¶
ConfirmRequest type
type ConfirmResponse ¶
type ConfirmResponse struct { ReturnCode string `json:"returnCode"` ReturnMessage string `json:"returnMessage"` Info struct { OrderID string `json:"orderId"` TransactionID int64 `json:"transactionId"` AuthorizationExpireDate string `json:"authorizationExpireDate,omitempty"` RegKey string `json:"regKey,omitempty"` PayInfo []struct { Method string `json:"method"` Amount int `json:"amount"` } `json:"payInfo"` } `json:"info"` }
ConfirmResponse type
type ExpireRegKeyResponse ¶
type ExpireRegKeyResponse struct { ReturnCode string `json:"returnCode"` ReturnMessage string `json:"returnMessage"` }
ExpireRegKeyResponse type
type PayPreapprovedRequest ¶
type PayPreapprovedRequest struct { ProductName string `json:"productName"` Amount int `json:"amount"` Currency string `json:"currency"` OrderID string `json:"orderId"` Capture *bool `json:"capture,omitempty"` }
PayPreapprovedRequest type
type PayPreapprovedResponse ¶
type PayPreapprovedResponse struct { ReturnCode string `json:"returnCode"` ReturnMessage string `json:"returnMessage"` Info struct { TransactionID int64 `json:"transactionId"` TransactionDate time.Time `json:"transactionDate"` } `json:"info"` }
PayPreapprovedResponse type
type PaymentDetailsRequest ¶
type PaymentDetailsRequest struct { TransactionID []int64 `url:"transactionId,omitempty"` OrderID []string `url:"orderId,omitempty"` Fields string `url:"fields,omitempty"` }
PaymentDetailsRequest type
type PaymentDetailsResponse ¶
type PaymentDetailsResponse struct { ReturnCode string `json:"returnCode"` ReturnMessage string `json:"returnMessage"` Info []struct { TransactionID int64 `json:"transactionId"` TransactionDate time.Time `json:"transactionDate"` TransactionType string `json:"transactionType"` PayStatus string `json:"payStatus"` ProductName string `json:"productName"` MerchantName string `json:"merchantName"` Currency string `json:"currency"` AuthorizationExpireDate string `json:"authorizationExpireDate"` PayInfo []struct { Method string `json:"method"` Amount int `json:"amount"` } `json:"payInfo"` // 原決済取引照会、および払い戻し取引がある場合 RefundList []struct { RefundTransactionID string `json:"refundTransactionId"` TransactionType string `json:"transactionType"` RefundAmount int `json:"refundAmount"` RefundTransactionDate time.Time `json:"refundTransactionDate"` } `json:"refundList,omitempty"` // 払い戻し取引の照会の場合 OriginalTransactionID int64 `json:"originalTransactionId,omitempty"` } `json:"info"` }
PaymentDetailsResponse type
type RefundRequest ¶
type RefundRequest struct {
RefundAmount int `json:"refundAmount,omitempty"`
}
RefundRequest type
type RefundResponse ¶
type RefundResponse struct { ReturnCode string `json:"returnCode"` ReturnMessage string `json:"returnMessage"` Info struct { RefundTransactionID int64 `json:"refundTransactionId"` RefundTransactionDate time.Time `json:"refundTransactionDate"` } `json:"info"` }
RefundResponse type
type RequestOptions ¶
type RequestOptions struct { Payment *RequestOptionsPayment `json:"payment,omitempty"` Display *RequestOptionsDisplay `json:"display,omitempty"` Shipping *RequestOptionsShipping `json:"shipping,omitempty"` Extras *RequestOptionsExtras `json:"extras,omitempty"` }
RequestOptions type
type RequestOptionsDisplay ¶
type RequestOptionsDisplay struct { Locale string `json:"locale,omitempty"` CheckConfirmURLBrowser *bool `json:"checkConfirmUrlBrowser,omitempty"` }
RequestOptionsDisplay type
type RequestOptionsExtras ¶
type RequestOptionsExtras struct { FamilyService struct { AddFriends []struct { Type string `json:"type,omitempty"` IDs []string `json:"ids,omitempty"` } `json:"addFriends,omitempty"` } `json:"familyService,omitempty"` BranchName string `json:"branchName,omitempty"` BranchID string `json:"branchId,omitempty"` }
RequestOptionsExtras type
type RequestOptionsPayment ¶
type RequestOptionsPayment struct { Capture *bool `json:"capture,omitempty"` PayType string `json:"payType,omitempty"` }
RequestOptionsPayment type
type RequestOptionsShipping ¶
type RequestOptionsShipping struct { Type string `json:"type,omitempty"` FeeInquiryURL string `json:"feeInquiryUrl,omitempty"` FeeInquiryType string `json:"feeInquiryType,omitempty"` }
RequestOptionsShipping type
type RequestPackage ¶
type RequestPackage struct { ID string `json:"id"` Amount int `json:"amount"` UserFee int `json:"userFee,omitempty"` Name string `json:"name"` Products []*RequestPackageProduct `json:"products"` }
RequestPackage type
type RequestPackageProduct ¶
type RequestPackageProduct 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"` }
RequestPackageProduct type
type RequestRedirectURLs ¶
type RequestRedirectURLs struct { AppPackageName string `json:"appPackageName,omitempty"` ConfirmURL string `json:"confirmUrl"` ConfirmURLType string `json:"confirmUrlType,omitempty"` CancelURL string `json:"cancelUrl"` }
RequestRedirectURLs type
type RequestRequest ¶
type RequestRequest struct { Amount int `json:"amount"` Currency string `json:"currency"` OrderID string `json:"orderId"` Packages []*RequestPackage `json:"packages"` RedirectURLs *RequestRedirectURLs `json:"redirectUrls"` Options *RequestOptions `json:"options,omitempty"` }
RequestRequest type
type RequestResponse ¶
type RequestResponse struct { ReturnCode string `json:"returnCode"` ReturnMessage string `json:"returnMessage"` Info struct { TransactionID int64 `json:"transactionId"` PaymentURL struct { Web string `json:"web"` App string `json:"app"` } `json:"paymentUrl"` PaymentAccessToken string `json:"paymentAccessToken"` } `json:"info"` }
RequestResponse type