coreapi

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2022 License: MIT Imports: 6 Imported by: 34

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Name   string   `json:"name"`
	Method string   `json:"method"`
	URL    string   `json:"url"`
	Fields []string `json:"fields"`
}

Action represents response action

type ApproveResponse

type ApproveResponse = ChargeResponse

ApproveResponse : Approve response type when calling Midtrans approve transaction API

func ApproveTransaction

func ApproveTransaction(param string) (*ApproveResponse, *midtrans.Error)

ApproveTransaction : Do `/{orderId}/approve` API request to Midtrans Core API return `coreapi.ApproveResponse`, more detail refer to: https://api-docs.midtrans.com/#approve-transaction

type BCABankTransferDetailFreeText

type BCABankTransferDetailFreeText struct {
	Inquiry []BCABankTransferLangDetail `json:"inquiry,omitempty"`
	Payment []BCABankTransferLangDetail `json:"payment,omitempty"`
}

BCABankTransferDetailFreeText : Represent BCA bank_transfer detail free_text

type BCABankTransferLangDetail

type BCABankTransferLangDetail struct {
	LangID string `json:"id,omitempty"`
	LangEN string `json:"en,omitempty"`
}

BCABankTransferLangDetail : Represent BCA bank_transfer lang detail

type BCAKlikPayDetails

type BCAKlikPayDetails struct {
	Desc    string `json:"description"`
	MiscFee int64  `json:"misc_fee,omitempty"`
}

BCAKlikPayDetails : Represent Internet Banking for BCA KlikPay

type BalanceDetails added in v1.2.1

type BalanceDetails struct {
	Value    string `json:"value"`
	Currency string `json:"currency"`
}

type BankTransferDetails

type BankTransferDetails struct {
	Bank     midtrans.Bank                  `json:"bank"`
	VaNumber string                         `json:"va_number,omitempty"`
	Permata  *PermataBankTransferDetail     `json:"permata,omitempty"`
	FreeText *BCABankTransferDetailFreeText `json:"free_text,omitempty"`
	Bca      *BcaBankTransferDetail         `json:"bca,omitempty"`
}

BankTransferDetails : Represent bank_transfer detail

type BcaBankTransferDetail

type BcaBankTransferDetail struct {
	SubCompanyCode string `json:"sub_company_code,omitempty"`
}

BcaBankTransferDetail : BCA sub company code directed for this transactions NOTE: Please contact Midtrans Sales Team.

type BcaKlikBCADetails

type BcaKlikBCADetails struct {
	Desc   string `json:"description"`
	UserID string `json:"user_id"`
}

BcaKlikBCADetails : Represent Internet Banking BCA KlikBCA detail

type BinResponse

type BinResponse struct {
	Data struct {
		RegistrationRequired string `json:"registration_required"`
		CountryName          string `json:"country_name"`
		CountryCode          string `json:"country_code"`
		Channel              string `json:"channel"`
		Brand                string `json:"brand"`
		BinType              string `json:"bin_type"`
		BinClass             string `json:"bin_class"`
		Bin                  string `json:"bin"`
		BankCode             string `json:"bank_code"`
		Bank                 string `json:"bank"`
	} `json:"data"`
}

func GetBIN

func GetBIN(binNumber string) (*BinResponse, *midtrans.Error)

GetBIN : Do `/v1/bins/{bin}` API request to Midtrans Core API return `coreapi.BinResponse`, more detail refer to: https://api-docs.midtrans.com/#bin-api

type CIMBClicksDetails

type CIMBClicksDetails struct {
	Desc string `json:"description"`
}

CIMBClicksDetails : Represent CIMB Clicks detail

type CancelResponse

type CancelResponse = ChargeResponse

CancelResponse : Cancel response type when calling Midtrans cancel transaction API

func CancelTransaction

func CancelTransaction(param string) (*CancelResponse, *midtrans.Error)

CancelTransaction : Do `/{orderId}/cancel` API request to Midtrans Core API return `coreapi.CancelResponse`, more detail refer to: https://api-docs.midtrans.com/#cancel-transaction

type CaptureReq

type CaptureReq struct {
	TransactionID string  `json:"transaction_id"`
	GrossAmt      float64 `json:"gross_amount"`
}

CaptureReq : Represent Capture request payload

type CaptureResponse

type CaptureResponse = ChargeResponse

CaptureResponse : Capture response type when calling Midtrans API capture for credit card transaction

func CaptureTransaction

func CaptureTransaction(req *CaptureReq) (*CaptureResponse, *midtrans.Error)

CaptureTransaction : Do `/{orderId}/capture` API request to Midtrans Core API return `coreapi.CaptureResponse`, with `coreapi.CaptureReq` as body parameter, will be converted to JSON, more detail refer to: https://api-docs.midtrans.com/#capture-transaction

type CardRegisterResponse

type CardRegisterResponse struct {
	StatusCode        string   `json:"status_code"`
	StatusMessage     string   `json:"status_message"`
	ValidationMessage []string `json:"validation_messages"`
	Id                string   `json:"id"`
	SavedTokenID      string   `json:"saved_token_id"`
	TransactionID     string   `json:"transaction_id"`
	MaskCard          string   `json:"masked_card"`
}

func RegisterCard

func RegisterCard(cardNumber string, expMonth int, expYear int) (*CardRegisterResponse, *midtrans.Error)

RegisterCard : Do `/card/register` API request to Midtrans Core API return `coreapi.CardRegisterResponse`, more detail refer to: https://api-docs.midtrans.com/#register-card

type CardTokenResponse

type CardTokenResponse struct {
	StatusCode        string   `json:"status_code"`
	StatusMessage     string   `json:"status_message"`
	ValidationMessage []string `json:"validation_messages"`
	Id                string   `json:"id"`
	TokenID           string   `json:"token_id"`
	Hash              string   `json:"hash"`
	RedirectURL       string   `json:"redirect_url"`
	Bank              string   `json:"bank"`
}

func CardPointInquiry

func CardPointInquiry(cardToken string) (*CardTokenResponse, *midtrans.Error)

CardPointInquiry : Do `/point_inquiry/{tokenId}` API request to Midtrans Core API return `coreapi.CardTokenResponse`, more detail refer to: https://api-docs.midtrans.com/#point-inquiry

func CardToken

func CardToken(cardNumber string, expMonth int, expYear int, cvv string) (*CardTokenResponse, *midtrans.Error)

CardToken : Do `/token` API request to Midtrans Core API return `coreapi.CardTokenResponse`, more detail refer to: https://api-docs.midtrans.com/#get-token

type ChargeReq

type ChargeReq struct {
	PaymentType        CoreapiPaymentType          `json:"payment_type"`
	TransactionDetails midtrans.TransactionDetails `json:"transaction_details"`

	Items           *[]midtrans.ItemDetails   `json:"item_details,omitempty"`
	CustomerDetails *midtrans.CustomerDetails `json:"customer_details,omitempty"`

	CreditCard      *CreditCardDetails      `json:"credit_card,omitempty"`
	BankTransfer    *BankTransferDetails    `json:"bank_transfer,omitempty"`
	EChannel        *EChannelDetail         `json:"echannel,omitempty"`
	Gopay           *GopayDetails           `json:"gopay,omitempty"`
	ShopeePay       *ShopeePayDetails       `json:"shopeepay,omitempty"`
	Qris            *QrisDetails            `json:"qris,omitempty"`
	BCAKlikPay      *BCAKlikPayDetails      `json:"bca_klikpay,omitempty"`
	BCAKlikBCA      *BcaKlikBCADetails      `json:"bca_klikbca,omitempty"`
	MandiriClickPay *MandiriClickPayDetails `json:"mandiri_clickpay,omitempty"`
	CIMBClicks      *CIMBClicksDetails      `json:"cimb_clicks,omitempty"`

	ConvStore *ConvStoreDetails `json:"cstore,omitempty"`

	CustomExpiry *CustomExpiry `json:"custom_expiry,omitempty"`
	CustomField1 *string       `json:"custom_field1,omitempty"`
	CustomField2 *string       `json:"custom_field2,omitempty"`
	CustomField3 *string       `json:"custom_field3,omitempty"`
	Metadata     interface{}   `json:"metadata,omitempty"`
}

ChargeReq : Represent Charge request payload

type ChargeReqWithMap

type ChargeReqWithMap map[string]interface{}

ChargeReqWithMap : Represent Charge request with map payload

type ChargeResponse

type ChargeResponse struct {
	TransactionID          string     `json:"transaction_id"`
	OrderID                string     `json:"order_id"`
	GrossAmount            string     `json:"gross_amount"`
	PaymentType            string     `json:"payment_type"`
	TransactionTime        string     `json:"transaction_time"`
	TransactionStatus      string     `json:"transaction_status"`
	FraudStatus            string     `json:"fraud_status"`
	MaskedCard             string     `json:"masked_card"`
	StatusCode             string     `json:"status_code"`
	Bank                   string     `json:"bank"`
	StatusMessage          string     `json:"status_message"`
	ApprovalCode           string     `json:"approval_code"`
	ChannelResponseCode    string     `json:"channel_response_code"`
	ChannelResponseMessage string     `json:"channel_response_message"`
	Currency               string     `json:"currency"`
	CardType               string     `json:"card_type"`
	RedirectURL            string     `json:"redirect_url"`
	ID                     string     `json:"id"`
	ValidationMessages     []string   `json:"validation_messages"`
	InstallmentTerm        string     `json:"installment_term"`
	Eci                    string     `json:"eci"`
	SavedTokenID           string     `json:"saved_token_id"`
	SavedTokenIDExpiredAt  string     `json:"saved_token_id_expired_at"`
	PointRedeemAmount      int        `json:"point_redeem_amount"`
	PointRedeemQuantity    int        `json:"point_redeem_quantity"`
	PointBalanceAmount     string     `json:"point_balance_amount"`
	PermataVaNumber        string     `json:"permata_va_number"`
	VaNumbers              []VANumber `json:"va_numbers"`
	BillKey                string     `json:"bill_key"`
	BillerCode             string     `json:"biller_code"`
	Acquirer               string     `json:"acquirer"`
	Actions                []Action   `json:"actions"`
	PaymentCode            string     `json:"payment_code"`
	Store                  string     `json:"store"`
}

ChargeResponse : CoreAPI charge response struct when calling Midtrans API

func ChargeTransaction

func ChargeTransaction(req *ChargeReq) (*ChargeResponse, *midtrans.Error)

ChargeTransaction : Do `/charge` API request to Midtrans Core API return `coreapi.ChargeResponse` with `coreapi.ChargeReq` as body parameter, will be converted to JSON, more detail refer to: https://api-docs.midtrans.com

type Client

type Client struct {
	ServerKey  string
	ClientKey  string
	Env        midtrans.EnvironmentType
	HttpClient midtrans.HttpClient
	Options    *midtrans.ConfigOptions
}

Client : CoreAPI Client struct

func (Client) ApproveTransaction

func (c Client) ApproveTransaction(param string) (*ApproveResponse, *midtrans.Error)

ApproveTransaction : Do `/{orderId}/approve` API request to Midtrans Core API return `coreapi.ApproveResponse`, more detail refer to: https://api-docs.midtrans.com/#approve-transaction

func (Client) CancelTransaction

func (c Client) CancelTransaction(param string) (*CancelResponse, *midtrans.Error)

CancelTransaction : Do `/{orderId}/cancel` API request to Midtrans Core API return `coreapi.CancelResponse`, more detail refer to: https://api-docs.midtrans.com/#cancel-transaction

func (Client) CaptureTransaction

func (c Client) CaptureTransaction(req *CaptureReq) (*CaptureResponse, *midtrans.Error)

CaptureTransaction : Do `/{orderId}/capture` API request to Midtrans Core API return `coreapi.CaptureResponse`, with `coreapi.CaptureReq` as body parameter, will be converted to JSON, more detail refer to: https://api-docs.midtrans.com/#capture-transaction

func (Client) CardPointInquiry

func (c Client) CardPointInquiry(cardToken string) (*CardTokenResponse, *midtrans.Error)

CardPointInquiry : Do `/point_inquiry/{tokenId}` API request to Midtrans Core API return `coreapi.CardTokenResponse`, more detail refer to: https://api-docs.midtrans.com/#point-inquiry

func (Client) CardToken

func (c Client) CardToken(cardNumber string, expMonth int, expYear int, cvv string, clientKey string) (*CardTokenResponse, *midtrans.Error)

CardToken : Do `/token` API request to Midtrans Core API return `coreapi.CardTokenResponse`, more detail refer to: https://api-docs.midtrans.com/#get-token

func (Client) ChargeTransaction

func (c Client) ChargeTransaction(req *ChargeReq) (*ChargeResponse, *midtrans.Error)

ChargeTransaction : Do `/charge` API request to Midtrans Core API return `coreapi.ChargeResponse` with `coreapi.ChargeReq` as body parameter, will be converted to JSON, more detail refer to: https://api-docs.midtrans.com

func (Client) ChargeTransactionWithMap

func (c Client) ChargeTransactionWithMap(req *ChargeReqWithMap) (ResponseWithMap, *midtrans.Error)

ChargeTransactionWithMap : Do `/charge` API request to Midtrans Core API return RAW MAP with Map as body parameter, will be converted to JSON, more detail refer to: https://api-docs.midtrans.com

func (Client) CheckTransaction

func (c Client) CheckTransaction(param string) (*TransactionStatusResponse, *midtrans.Error)

CheckTransaction : Do `/{orderId}/status` API request to Midtrans Core API return `coreapi.TransactionStatusResponse`, more detail refer to: https://api-docs.midtrans.com/#get-transaction-status

func (Client) CreateSubscription added in v1.1.0

func (c Client) CreateSubscription(req *SubscriptionReq) (*CreateSubscriptionResponse, *midtrans.Error)

CreateSubscription : Do `/v1/subscriptions` To create subscription that contains all details for creating transaction more detail refer to: http://api-docs.midtrans.com/#recurring-api

func (Client) DenyTransaction

func (c Client) DenyTransaction(param string) (*DenyResponse, *midtrans.Error)

DenyTransaction : Do `/{orderId}/deny` API request to Midtrans Core API return `coreapi.DenyResponse`, more detail refer to: https://api-docs.midtrans.com/#deny-transaction

func (Client) DirectRefundTransaction

func (c Client) DirectRefundTransaction(param string, req *RefundReq) (*RefundResponse, *midtrans.Error)

DirectRefundTransaction : Do `/{orderId}/refund/online/direct` API request to Midtrans Core API return `coreapi.RefundResponse`, with `coreapi.CaptureReq` as body parameter, will be converted to JSON, more detail refer to: https://api-docs.midtrans.com/#direct-refund-transaction

func (Client) DisableSubscription added in v1.1.0

func (c Client) DisableSubscription(subscriptionId string) (*DisableSubscriptionResponse, *midtrans.Error)

DisableSubscription : Do `/v1/subscriptions/{subscription_id}/disable` To make the subscription inactive (the subscription will not create transaction anymore) more detail refer to: http://api-docs.midtrans.com/#recurring-api

func (Client) EnableSubscription added in v1.1.0

func (c Client) EnableSubscription(subscriptionId string) (*EnableSubscriptionResponse, *midtrans.Error)

EnableSubscription : Do `/v1/subscriptions/{subscription_id}/enable` To make the subscription active (the subscription will create periodic transaction) more detail refer to: http://api-docs.midtrans.com/#recurring-api

func (Client) ExpireTransaction

func (c Client) ExpireTransaction(param string) (*ExpireResponse, *midtrans.Error)

ExpireTransaction : Do `/{orderId}/expire` API request to Midtrans Core API return `coreapi.ExpireResponse`, more detail refer to: https://api-docs.midtrans.com/#expire-transaction

func (Client) GetBIN

func (c Client) GetBIN(binNumber string) (*BinResponse, *midtrans.Error)

GetBIN : Do `v1/bins/{bin}` API request to Midtrans Core API return `coreapi.BinResponse`, more detail refer to: https://api-docs.midtrans.com/#bin-api

func (Client) GetPaymentAccount added in v1.2.1

func (c Client) GetPaymentAccount(accountId string) (*PaymentAccountResponse, *midtrans.Error)

GetPaymentAccount : Do `/v2/pay/account/{account_id}t` to get customer payment account details more detail refer to: https://api-docs.midtrans.com/#get-pay-account

func (Client) GetStatusB2B

func (c Client) GetStatusB2B(param string) (*TransactionStatusB2bResponse, *midtrans.Error)

GetStatusB2B : Do `/{orderId}/status/b2b` API request to Midtrans Core API return `coreapi.TransactionStatusB2bResponse`, more detail refer to: https://api-docs.midtrans.com/#get-transaction-status-b2b

func (Client) GetSubscription added in v1.1.0

func (c Client) GetSubscription(subscriptionId string) (*StatusSubscriptionResponse, *midtrans.Error)

GetSubscription : Do `/v1/subscriptions/{subscription_id}` To find subscription by id to see the subscription details more detail refer to: http://api-docs.midtrans.com/#recurring-api

func (Client) LinkPaymentAccount added in v1.2.1

func (c Client) LinkPaymentAccount(req *PaymentAccountReq) (*PaymentAccountResponse, *midtrans.Error)

LinkPaymentAccount : Do `/v2/pay/account` to link customer account to be used for specific payment channels more detail refer to: https://api-docs.midtrans.com/#create-pay-account

func (*Client) New

func (c *Client) New(serverKey string, env midtrans.EnvironmentType)

New : this function will always be called when the CoreApi is initiated

func (Client) RefundTransaction

func (c Client) RefundTransaction(param string, req *RefundReq) (*RefundResponse, *midtrans.Error)

RefundTransaction : Do `/{orderId}/refund` API request to Midtrans Core API return `coreapi.RefundResponse`, with `coreapi.RefundReq` as body parameter, will be converted to JSON, more detail refer to: https://api-docs.midtrans.com/#refund-transaction

func (Client) RegisterCard

func (c Client) RegisterCard(cardNumber string, expMonth int, expYear int, clientKey string) (*CardRegisterResponse, *midtrans.Error)

RegisterCard : Do `/card/register` API request to Midtrans Core API return `coreapi.CardRegisterResponse`, more detail refer to: https://api-docs.midtrans.com/#register-card

func (Client) UnlinkPaymentAccount added in v1.2.1

func (c Client) UnlinkPaymentAccount(accountId string) (*PaymentAccountResponse, *midtrans.Error)

UnlinkPaymentAccount : Do `/v2/pay/account/{account_id}/unbind` to unbind a linked customer account more detail refer to: https://api-docs.midtrans.com/#unbind-pay-account

func (Client) UpdateSubscription added in v1.1.0

func (c Client) UpdateSubscription(subscriptionId string, req *SubscriptionReq) (*UpdateSubscriptionResponse, *midtrans.Error)

UpdateSubscription : Do `/v1/subscriptions/{subscription_id}` To update existing subscription details more detail refer to: http://api-docs.midtrans.com/#recurring-api

type ConvStoreDetails

type ConvStoreDetails struct {
	Store   string `json:"store"`
	Message string `json:"message,omitempty"`

	AlfamartFreeText1 string `json:"alfamart_free_text_1,omitempty"`
	AlfamartFreeText2 string `json:"alfamart_free_text_2,omitempty"`
	AlfamartFreeText3 string `json:"alfamart_free_text_3,omitempty"`
}

ConvStoreDetails : Represent cstore detail

type CoreapiPaymentType

type CoreapiPaymentType string
const (
	// PaymentTypeBankTransfer : bank_transfer
	PaymentTypeBankTransfer CoreapiPaymentType = "bank_transfer"

	// PaymentTypeGopay : gopay
	PaymentTypeGopay CoreapiPaymentType = "gopay"

	// PaymentTypeShopeepay : shopeepay
	PaymentTypeShopeepay CoreapiPaymentType = "shopeepay"

	// PaymentTypeQris : qris
	PaymentTypeQris CoreapiPaymentType = "qris"

	// PaymentTypeCreditCard : credit_card
	PaymentTypeCreditCard CoreapiPaymentType = "credit_card"

	// PaymentTypeEChannel : echannel
	PaymentTypeEChannel CoreapiPaymentType = "echannel"

	// PaymentTypeBCAKlikpay : bca_klikpay
	PaymentTypeBCAKlikpay CoreapiPaymentType = "bca_klikpay"

	// PaymentTypeKlikBca : bca_klikbca
	PaymentTypeKlikBca CoreapiPaymentType = "bca_klikbca"

	// PaymentTypeBRIEpay : bri_epay
	PaymentTypeBRIEpay CoreapiPaymentType = "bri_epay"

	// PaymentTypeCimbClicks : cimb_clicks
	PaymentTypeCimbClicks CoreapiPaymentType = "cimb_clicks"

	// PaymentTypeDanamonOnline : danamon_online
	PaymentTypeDanamonOnline CoreapiPaymentType = "danamon_online"

	// PaymentTypeConvenienceStore : cstore
	PaymentTypeConvenienceStore CoreapiPaymentType = "cstore"

	// PaymentTypeAkulaku : akulaku
	PaymentTypeAkulaku CoreapiPaymentType = "akulaku"

	// PaymentTypeMandiriClickpay : mandiri_clickpay
	PaymentTypeMandiriClickpay CoreapiPaymentType = "mandiri_clickpay"
)

type CreateSubscriptionResponse added in v1.1.0

type CreateSubscriptionResponse struct {
	ID              string                   `json:"id"`
	Name            string                   `json:"name"`
	Amount          string                   `json:"amount"`
	Currency        string                   `json:"currency"`
	CreatedAt       string                   `json:"created_at"`
	Schedule        ScheduleResponse         `json:"schedule"`
	Status          string                   `json:"status"`
	Token           string                   `json:"token"`
	PaymentType     string                   `json:"payment_type"`
	Metadata        interface{}              `json:"metadata"`
	CustomerDetails midtrans.CustomerDetails `json:"customer_details"`
	TransactionId   []string                 `json:"transaction_id"`

	StatusMessage     string   `json:"status_message"`
	ValidationMessage []string `json:"validation_message"`
}

func CreateSubscription added in v1.1.0

func CreateSubscription(req *SubscriptionReq) (*CreateSubscriptionResponse, *midtrans.Error)

CreateSubscription : Do `/v1/subscriptions` To create subscription that contains all details for creating transaction more detail refer to: http://api-docs.midtrans.com/#recurring-api

type CreditCardDetails

type CreditCardDetails struct {
	// TokenID represents customer credit card information
	TokenID string `json:"token_id"`

	// Authentication Flag to enable the 3D secure authentication. Default value is false.
	Authentication bool `json:"authentication,omitempty"`

	// Bank Acquiring bank. Valid values: `midtrans.BankBca` `midtrans.BankMandiri`, `midtrans.BankBni`,
	//`midtrans.BankCimb`, `midtrans.BankMaybank`, and `midtrans.BankBri`
	Bank string `json:"bank,omitempty"`

	// InstallmentTerm for installment tenor
	InstallmentTerm int8 `json:"installment_term,omitempty"`

	// Type Used on preauthorization feature. Valid value: authorize
	Type string `json:"type,omitempty"`

	// Bins List of credit card's BIN (Bank Identification Number) that is allowed for transaction
	Bins []string `json:"bins,omitempty"`

	// SaveTokenID Used on 'one click' or 'two clicks' feature. Enabling it will return a `Response.SavedCardTokenID` on the response
	// and notification body that can be used for the next transaction
	SaveTokenID bool `json:"save_token_id,omitempty"`

	// PointRedeemAmount For Mandiri Point, you can only do Full Redemption.(use -1 for Full Redemption)
	PointRedeemAmount int64 `json:"point_redeem_amount,omitempty"`
}

CreditCardDetails : Represent credit card detail for PaymentTypeCreditCard payment type

type CustomExpiry

type CustomExpiry struct {
	// OrderTime Time when the order is created in merchant website. Format: yyyy-MM-dd hh:mm:ss Z.
	// If attribute undefined, expiry time starts from transaction time
	OrderTime string `json:"order_time,omitempty"`

	// ExpiryDuration Time duration the payment will remain valid
	ExpiryDuration int `json:"expiry_duration,omitempty"`

	// Unit for expiry_duration. Valid values are: second, minute, hour, or day.
	// NOTE: If attribute undefined, default unit is minute
	Unit string `json:"unit,omitempty"`
}

CustomExpiry : Represent Core API custom_expiry

type DenyResponse

type DenyResponse = ChargeResponse

DenyResponse : Deny response type when calling Midtrans deny transaction API

func DenyTransaction

func DenyTransaction(param string) (*DenyResponse, *midtrans.Error)

DenyTransaction : Do `/{orderId}/deny` API request to Midtrans Core API return `coreapi.DenyResponse`, more detail refer to: https://api-docs.midtrans.com/#deny-transaction

type DisableSubscriptionResponse added in v1.1.0

type DisableSubscriptionResponse = UpdateSubscriptionResponse

func DisableSubscription added in v1.1.0

func DisableSubscription(subscriptionId string) (*DisableSubscriptionResponse, *midtrans.Error)

DisableSubscription : Do `/v1/subscriptions/{subscription_id}/disable` To make the subscription inactive (the subscription will not create transaction anymore) more detail refer to: http://api-docs.midtrans.com/#recurring-api

type EChannelDetail

type EChannelDetail struct {
	BillInfo1 string `json:"bill_info1"`
	BillInfo2 string `json:"bill_info2"`
	BillInfo3 string `json:"bill_info3,omitempty"`
	BillInfo4 string `json:"bill_info4,omitempty"`
	BillInfo5 string `json:"bill_info5,omitempty"`
	BillInfo6 string `json:"bill_info6,omitempty"`
	BillInfo7 string `json:"bill_info7,omitempty"`
	BillInfo8 string `json:"bill_info8,omitempty"`
}

EChannelDetail : Represent Mandiri Bill bank transfer detail

type EnableSubscriptionResponse added in v1.1.0

type EnableSubscriptionResponse = UpdateSubscriptionResponse

func EnableSubscription added in v1.1.0

func EnableSubscription(subscriptionId string) (*EnableSubscriptionResponse, *midtrans.Error)

EnableSubscription : Do `/v1/subscriptions/{subscription_id}/enable` To make the subscription active (the subscription will create periodic transaction) more detail refer to: http://api-docs.midtrans.com/#recurring-api

type ExpireResponse

type ExpireResponse = ChargeResponse

ExpireResponse : Expire response type when calling Midtrans expire transaction API

func ExpireTransaction

func ExpireTransaction(param string) (*ExpireResponse, *midtrans.Error)

ExpireTransaction : Do `/{orderId}/expire` API request to Midtrans Core API return `coreapi.ExpireResponse`, more detail refer to: https://api-docs.midtrans.com/#expire-transaction

type GopayDetails

type GopayDetails struct {
	EnableCallback     bool   `json:"enable_callback,omitempty"`      // To determine appending callback url in the deeplink. Default value: false
	CallbackUrl        string `json:"callback_url,omitempty"`         // To determine where GO-JEK apps will redirect after successful payment. Can be HTTP or deeplink url. Default value: callback_url in dashboard settings
	AccountID          string `json:"account_id,omitempty"`           // Required for GoPay tokenization. Linked customer account ID from create pay account API.
	PaymentOptionToken string `json:"payment_option_token,omitempty"` // Required for GoPay tokenization. Token to specify the payment option made by the customer from get pay account API metadata.
	PreAuth            bool   `json:"pre_auth,omitempty"`             // To make payment mode into reservation of customer balance only. Once, customer balance is reserved, a subsequent capture call is expected to be initiated by merchants.
	Recurring          bool   `json:"recurring,omitempty"`
}

GopayDetails : Represent gopay detail

type GopayPartnerDetails added in v1.2.1

type GopayPartnerDetails struct {
	PhoneNumber string `json:"phone_number"`           // Phone number linked to the customer account
	CountryCode string `json:"country_code"`           // Country code associated to the phone number
	RedirectURL string `json:"redirect_url,omitempty"` // URL where user will be redirected to after finishing the confirmation on Gojek app
}

type GopaySubscriptionDetails added in v1.1.0

type GopaySubscriptionDetails struct {
	AccountId string `json:"account_id"` // Gopay Account ID from Core API
}

type MandiriClickPayDetails

type MandiriClickPayDetails struct {
	// TokenID token id from Get card token Step
	TokenID string `json:"token_id"`
	Input1  string `json:"input1"`
	Input2  string `json:"input2"`

	// Input3 5-digits random number you gave to the customer
	Input3 string `json:"input3"`

	// Token Number generated by customer's physical token
	Token string `json:"token"`
}

MandiriClickPayDetails : Represent Mandiri ClickPay detail

type PaymentAccountMetadataDetails added in v1.2.1

type PaymentAccountMetadataDetails struct {
	PaymentOptions []PaymentOptionsDetails `json:"payment_options"`
}

type PaymentAccountReq added in v1.2.1

type PaymentAccountReq struct {
	PaymentType  CoreapiPaymentType   `json:"payment_type"`  // Payment channel where the account register to
	GopayPartner *GopayPartnerDetails `json:"gopay_partner"` // GoPay linking specific parameters
}

type PaymentAccountResponse added in v1.2.1

type PaymentAccountResponse struct {
	StatusCode             string                        `json:"status_code"`
	PaymentType            string                        `json:"payment_type"`
	AccountId              string                        `json:"account_id"`
	AccountStatus          string                        `json:"account_status"`
	ChannelResponseCode    string                        `json:"channel_response_code"`
	ChannelResponseMessage string                        `json:"channel_response_message"`
	Action                 Action                        `json:"action"`
	Metadata               PaymentAccountMetadataDetails `json:"metadata"`
	StatusMessage          string                        `json:"status_message"`
	ID                     string                        `json:"id"`
}

func GetPaymentAccount added in v1.2.1

func GetPaymentAccount(accountId string) (*PaymentAccountResponse, *midtrans.Error)

GetPaymentAccount : Do `/v2/pay/account/{account_id}` to get customer payment account details more detail refer to: https://api-docs.midtrans.com/#get-pay-account

func LinkPaymentAccount added in v1.2.1

func LinkPaymentAccount(req *PaymentAccountReq) (*PaymentAccountResponse, *midtrans.Error)

LinkPaymentAccount : Do `/v2/pay/account/{account_id}` to link customer account to be used for specific payment channels more detail refer to: https://api-docs.midtrans.com/#get-pay-account

func UnlinkPaymentAccount added in v1.2.1

func UnlinkPaymentAccount(accountId string) (*PaymentAccountResponse, *midtrans.Error)

UnlinkPaymentAccount : Do `/v2/pay/account/{account_id}/unbind` to unbind a linked customer account more detail refer to: https://api-docs.midtrans.com/#unbind-pay-account

type PaymentAmount

type PaymentAmount struct {
	PaidAt string `json:"paid_at"`
	Amount string `json:"amount"`
}

type PaymentOptionsDetails added in v1.2.1

type PaymentOptionsDetails struct {
	Name     string         `json:"name"`
	Active   bool           `json:"active"`
	Metadata interface{}    `json:"metadata"`
	Balance  BalanceDetails `json:"balance"`
	Token    string         `json:"token"`
}

type PermataBankTransferDetail

type PermataBankTransferDetail struct {
	RecipientName string `json:"recipient_name,omitempty"`
}

PermataBankTransferDetail : Represent Recipient for bank transfer Permata

type QrisDetails

type QrisDetails struct {
	Acquirer string `json:"acquirer,omitempty"`
}

QrisDetails QRIS is a QR payment standard in Indonesia that is developed by Bank Indonesia (BI). Users could scan and pay the QR from any payment providers registered as the issuer

type RefundDetails

type RefundDetails struct {
	RefundChargebackID   int    `json:"refund_chargeback_id"`
	RefundChargebackUUID string `json:"refund_chargeback_uuid"`
	RefundAmount         string `json:"refund_amount"`
	Reason               string `json:"reason"`
	RefundKey            string `json:"refund_key"`
	RefundMethod         string `json:"refund_method"`
	BankConfirmedAt      string `json:"bank_confirmed_at"`
	CreatedAt            string `json:"created_at"`
}

RefundDetails Details

type RefundReq

type RefundReq struct {
	RefundKey string `json:"refund_key"`
	Amount    int64  `json:"amount"`
	Reason    string `json:"reason"`
}

RefundReq : Represent Refund request payload

type RefundResponse

type RefundResponse struct {
	StatusCode           string `json:"status_code"`
	StatusMessage        string `json:"status_message"`
	ID                   string `json:"id"`
	TransactionID        string `json:"transaction_id"`
	OrderID              string `json:"order_id"`
	GrossAmount          string `json:"gross_amount"`
	Currency             string `json:"currency"`
	MerchantID           string `json:"merchant_id"`
	PaymentType          string `json:"payment_type"`
	TransactionTime      string `json:"transaction_time"`
	TransactionStatus    string `json:"transaction_status"`
	SettlementTime       string `json:"settlement_time"`
	FraudStatus          string `json:"fraud_status"`
	RefundChargebackID   int    `json:"refund_chargeback_id"`
	RefundChargebackUUID string `json:"refund_chargeback_uuid"`
	RefundAmount         string `json:"refund_amount"`
	RefundKey            string `json:"refund_key"`
}

RefundResponse : Refund response struct when calling Midtrans refund and direct refund API

func DirectRefundTransaction

func DirectRefundTransaction(param string, req *RefundReq) (*RefundResponse, *midtrans.Error)

DirectRefundTransaction : Do `/{orderId}/refund/online/direct` API request to Midtrans Core API return `coreapi.RefundResponse`, with `coreapi.RefundReq` as body parameter, will be converted to JSON, more detail refer to: https://api-docs.midtrans.com/#direct-refund-transaction

func RefundTransaction

func RefundTransaction(param string, req *RefundReq) (*RefundResponse, *midtrans.Error)

RefundTransaction : Do `/{orderId}/refund` API request to Midtrans Core API return `coreapi.RefundResponse`, with `coreapi.RefundReq` as body parameter, will be converted to JSON, more detail refer to: https://api-docs.midtrans.com/#refund-transaction

type ResponseWithMap

type ResponseWithMap map[string]interface{}

func ChargeTransactionWithMap

func ChargeTransactionWithMap(req *ChargeReqWithMap) (ResponseWithMap, *midtrans.Error)

ChargeTransactionWithMap : Do `/charge` API request to Midtrans Core API return RAW MAP with Map as body parameter, will be converted to JSON, more detail refer to: https://api-docs.midtrans.com

type ScheduleDetails added in v1.2.1

type ScheduleDetails struct {
	// Subscription's interval given by merchant
	Interval int `json:"interval"`

	// Interval temporal unit Note: currently only support day, week, and month
	IntervalUnit string `json:"interval_unit"`

	// MaxInterval Maximum interval of subscription. Subscription will end after maximum interval is reached
	MaxInterval int `json:"max_interval"`

	// StartTime Timestamp of subscription, format: yyyy-MM-dd HH:mm:ss Z. The value must be after the current time.
	// If specified, first payment will happen on start_time. If start_time is not specified, the default value for
	// start_time will be current time and first payment will happen on one interval after current time.
	StartTime string `json:"start_time,omitempty"`
}

ScheduleDetails Create Subscription schedule object

type ScheduleResponse added in v1.1.0

type ScheduleResponse struct {
	Interval            int    `json:"interval"`
	IntervalUnit        string `json:"interval_unit"`
	MaxInterval         int    `json:"max_interval"`
	CurrentInterval     int    `json:"current_interval"`
	StartTime           string `json:"start_time"`
	PreviousExecutionAt string `json:"previous_execution_at"`
	NextExecutionAt     string `json:"next_execution_at"`
}

ScheduleResponse Subscription schedule response object

type ShopeePayDetails

type ShopeePayDetails struct {
	CallbackUrl string `json:"callback_url,omitempty"`
}

ShopeePayDetails : Represent shopeepay detail

type StatusSubscriptionResponse added in v1.1.0

type StatusSubscriptionResponse = CreateSubscriptionResponse

func GetSubscription added in v1.1.0

func GetSubscription(subscriptionId string) (*StatusSubscriptionResponse, *midtrans.Error)

GetSubscription : Do `/v1/subscriptions/{subscription_id}` To find subscription by id to see the subscription details more detail refer to: http://api-docs.midtrans.com/#recurring-api

type SubscriptionPaymentType added in v1.1.0

type SubscriptionPaymentType = CoreapiPaymentType

type SubscriptionReq added in v1.1.0

type SubscriptionReq struct {
	// Name Subscription's name that will be used to generate transaction's order id.
	// Note: Allowed symbols are dash(-), underscore(_), tilde (~), and dot (.)
	Name string `json:"name"`

	// Amount that will be used to make recurring charge. Note: Do not use decimal
	Amount int64 `json:"amount"`

	// Currency ISO-4217 representation for 3 digit alphabetic currency code. Note: Currently only support IDR
	Currency string `json:"currency"`

	// PaymentType Transaction payment method. Note: currently only support credit_card and gopay
	PaymentType SubscriptionPaymentType `json:"payment_type"`

	// Token Saved payment token. Note: For `credit_card` should use `saved_token_id` received in charge response.
	// For gopay should use payment_options. token received in get pay account response
	Token string `json:"token"`

	// Schedule Subscription schedule details
	Schedule ScheduleDetails `json:"schedule"`

	// Metadata of subscription from merchant, the size must be less than 1KB
	Metadata interface{} `json:"metadata,omitempty"`

	// CustomerDetails Customer details information
	CustomerDetails *midtrans.CustomerDetails `json:"customer_details,omitempty"`

	// Gopay subscription information, required if payment type is gopay
	Gopay *GopaySubscriptionDetails `json:"gopay,omitempty"`
}

type TransactionStatusB2bResponse

type TransactionStatusB2bResponse struct {
	StatusCode    string                      `json:"status_code"`
	StatusMessage string                      `json:"status_message"`
	ID            string                      `json:"id"`
	Transactions  []TransactionStatusResponse `json:"transactions"`
}

func GetStatusB2B

func GetStatusB2B(param string) (*TransactionStatusB2bResponse, *midtrans.Error)

GetStatusB2B : Do `/{orderId}/status/b2b` API request to Midtrans Core API return `coreapi.TransactionStatusB2bResponse`, more detail refer to: https://api-docs.midtrans.com/#get-transaction-status-b2b

type TransactionStatusResponse

type TransactionStatusResponse struct {
	TransactionTime        string          `json:"transaction_time"`
	GrossAmount            string          `json:"gross_amount"`
	Currency               string          `json:"currency"`
	OrderID                string          `json:"order_id"`
	PaymentType            string          `json:"payment_type"`
	SignatureKey           string          `json:"signature_key"`
	StatusCode             string          `json:"status_code"`
	TransactionID          string          `json:"transaction_id"`
	TransactionStatus      string          `json:"transaction_status"`
	FraudStatus            string          `json:"fraud_status"`
	SettlementTime         string          `json:"settlement_time"`
	StatusMessage          string          `json:"status_message"`
	MerchantID             string          `json:"merchant_id"`
	PermataVaNumber        string          `json:"permata_va_number"`
	VaNumbers              []VANumber      `json:"va_numbers"`
	PaymentAmounts         []PaymentAmount `json:"payment_amounts"`
	ID                     string          `json:"id"`
	PaymentCode            string          `json:"payment_code"`
	Store                  string          `json:"store"`
	MaskedCard             string          `json:"masked_card"`
	Bank                   string          `json:"bank"`
	ApprovalCode           string          `json:"approval_code"`
	Eci                    string          `json:"eci"`
	ChannelResponseCode    string          `json:"channel_response_code"`
	ChannelResponseMessage string          `json:"channel_response_message"`
	CardType               string          `json:"card_type"`
	Refunds                []RefundDetails `json:"refunds"`
	RefundAmount           string          `json:"refund_amount"`
	BillKey                string          `json:"bill_key"`
	BillerCode             string          `json:"biller_code"`
	TransactionType        string          `json:"transaction_type"`
	Issuer                 string          `json:"issuer"`
	Acquirer               string          `json:"acquirer"`
	CustomField1           string          `json:"custom_field1"`
	CustomField2           string          `json:"custom_field2"`
	CustomField3           string          `json:"custom_field3"`
	Metadata               interface{}     `json:"metadata"`
	PaymentOptionsType     string          `json:"payment_options_type"`
}

TransactionStatusResponse : Status transaction response struct

func CheckTransaction

func CheckTransaction(param string) (*TransactionStatusResponse, *midtrans.Error)

CheckTransaction : Do `/{orderId}/status` API request to Midtrans Core API return `coreapi.TransactionStatusResponse`, more detail refer to: https://api-docs.midtrans.com/#get-transaction-status

type UpdateSubscriptionResponse added in v1.1.0

type UpdateSubscriptionResponse struct {
	StatusMessage string `json:"status_message"`
}

func UpdateSubscription added in v1.1.0

func UpdateSubscription(subscriptionId string, req *SubscriptionReq) (*UpdateSubscriptionResponse, *midtrans.Error)

UpdateSubscription : Do `/v1/subscriptions/{subscription_id}` To update existing subscription details more detail refer to: http://api-docs.midtrans.com/#recurring-api

type VANumber

type VANumber struct {
	Bank     string `json:"bank"`
	VANumber string `json:"va_number"`
}

VANumber : bank virtual account number

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL