coreapi

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: MIT Imports: 6 Imported by: 58

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 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, cvv 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

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) 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) 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) 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) 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, cvv string, 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

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 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 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 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"`
	CallbackUrl    string `json:"callback_url,omitempty"`
}

GopayDetails : Represent gopay detail

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 PaymentAmount

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

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 ShopeePayDetails

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

ShopeePayDetails : Represent shopeepay detail

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"`
}

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 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