### Initiate POS APM Payment (Node.js Example) Source: https://developer.craftgate.io/api/payment/payment-with-garantipay-v2 Example code snippet in Node.js for initiating a POS APM payment with GarantiPay. ```APIDOC ## Initiate POS APM Payment ### Description This example demonstrates how to initiate a POS APM payment using the Craftgate Node.js client. ### Method POST ### Endpoint `/payment/v1/pos-apm/initialize` ### Request Body - **price** (number) - Required - The total price of the payment. - **paidPrice** (number) - Required - The price to be paid by the customer. - **currency** (Currency) - Required - The currency of the payment (e.g., TRY). - **paymentGroup** (PaymentGroup) - Required - The group of the payment (e.g., ListingOrSubscription). - **conversationId** (string) - Required - A unique identifier for the conversation. - **paymentProvider** (PosApmPaymentProvider) - Required - The payment provider to use (e.g., GarantiPay). - **callbackUrl** (string) - Required - The URL to which the callback will be sent. - **items** (array) - Required - An array of items included in the payment. - **name** (string) - Required - The name of the item. - **price** (number) - Required - The price of the item. - **externalId** (string) - Required - The external ID of the item. - **additionalParams** (object) - Optional - Additional parameters for the payment. - **integrationType** (string) - Optional - The type of integration (e.g., WEB2APP). ### Request Example ```javascript const Craftgate = require('@craftgate/craftgate'); const craftgate = new Craftgate.Client({ apiKey: 'YOUR_SANDBOX_API_KEY', secretKey: 'YOUR_SANDBOX_API_KEY', baseUrl: 'https://sandbox-api.craftgate.io' }); const request = { price: 100.0, paidPrice: 100.0, currency: Craftgate.Model.Currency.TRY, paymentGroup: Craftgate.Model.PaymentGroup.ListingOrSubscription, conversationId: '456d1297-908e-4bd6-a13b-4be31a6e47d5', paymentProvider: Craftgate.Model.PosApmPaymentProvider.GarantiPay, callbackUrl: 'https://www.your-website.com/craftgate-pos-apm-callback', items: [ { name: 'Item 1', price: 30.0, externalId: '123d1297-839e-4bd6-a13b-4be31a6e12a8' }, { name: 'Item 2', price: 50.0, externalId: '789d1297-839e-4bd6-a13b-4be31a6e13f7' }, { name: 'Item 3', price: 20.0, externalId: '3a1d1297-839e-4bd6-a13b-4be31a6e18e6' } ], additionalParams: { integrationType: 'WEB2APP' } }; craftgate.payment().initPosApmPayment(request) .then(result => console.info('Payment successful', result)) .catch(err => console.error('Payment failed', err)); ``` ### Response #### Success Response (200) - **paymentId** (number) - The payment ID generated by Craftgate. - **status** (string) - The status of the payment initiation. - **conversationId** (string) - The conversation ID used in the request. - **redirectUrl** (string) - The URL to redirect the user for payment completion (if applicable). #### Response Example ```json { "paymentId": 123456789, "status": "SUCCESS", "conversationId": "456d1297-908e-4bd6-a13b-4be31a6e47d5", "redirectUrl": "https://example.com/payment/redirect?token=..." } ``` ``` -------------------------------- ### GET /onboarding/v1/members Source: https://developer.craftgate.io/api/member/search-members Sistemde kayıtlı üyeleri aramak ve filtrelemek için kullanılır. ```APIDOC ## GET /onboarding/v1/members ### Description Bu endpoint, sistemdeki üyeleri belirtilen kriterlere göre aramak ve listelemek için kullanılır. ### Method GET ### Endpoint /onboarding/v1/members ### Parameters #### Query Parameters - **isBuyer** (boolean) - Optional - Üyenin alıcı olma durumu - **isSubMerchant** (boolean) - Optional - Üyenin satıcı olma durumu - **memberType** (MemberType) - Optional - Üye türü (PERSONAL, PRIVATE_COMPANY, LIMITED_OR_JOINT_STOCK_COMPANY) - **memberExternalId** (string) - Optional - Üye dış ID değeri - **memberIds** (number[]) - Optional - Üye ID listesi - **name** (string) - Optional - Üye ismi - **page** (number) - Optional - Sayfalama için sayfa sayısı - **size** (number) - Optional - Sayfalama için sonuç sayısı ### Response #### Success Response (200) - **id** (number) - Üye ID değeri - **createdDate** (date) - Üye yaratılan tarih - **updatedDate** (date) - Üye güncellenen tarih - **status** (Status) - Üye durumu (ACTIVE, PASSIVE) - **isBuyer** (boolean) - Üyenin alıcı olma durumu - **isSubMerchant** (boolean) - Üyenin satıcı olma durumu - **memberType** (MemberType) - Üye türü - **memberExternalId** (string) - Üye dış ID değeri - **name** (string) - Üye ismi - **address** (string) - Üye adresi - **email** (string) - Üyeye ait email bilgisi - **iban** (string) - Üyeye ait iban bilgisi - **settlementEarningsDestination** (SettlementEarningsDestination) - Üye kazançları dağıtım yeri (IBAN, WALLET, CROSS_BORDER) - **phoneNumber** (string) - Üye telefon numarası - **taxOffice** (string) - Üye vergi dairesi - **taxNumber** (string) - Üye vergi no - **contactName** (string) - Üye ulaşılabilir kişi ismi - **contactSurname** (string) - Üye ulaşılabilir kişi soyismi - **legalCompanyTitle** (string) - Resmi şirket ismi - **subMerchantMaximumAllowedNegativeBalance** (number) - Satıcılar için eksi bakiye limiti - **settlementDelayCount** (number) - Satıcılar için blokaj gün süresi ``` -------------------------------- ### GET /onboarding/v1/members/:id Source: https://developer.craftgate.io/api/member/retrieve-member Belirtilen üye ID'sine sahip üyenin detaylı bilgilerini getirir. ```APIDOC ## GET /onboarding/v1/members/:id ### Description Belirtilen üye ID'sine sahip üyenin detaylı bilgilerini getirir. ### Method GET ### Endpoint /onboarding/v1/members/:id ### Parameters #### Path Parameters - **id** (number) - Required - Üye ID değeri ### Response #### Success Response (200) - **id** (number) - Üye ID değeri - **createdDate** (date) - Üye yaratılan tarih - **updatedDate** (date) - Üye güncellenen tarih - **status** (Status) - Üye durumunu gösteren değer (ACTIVE, PASSIVE) - **isBuyer** (boolean) - Üyenin alıcı olma durumu - **isSubMerchant** (boolean) - Üyenin satıcı olma durumu - **memberType** (MemberType) - Üye türü (PERSONAL, PRIVATE_COMPANY, LIMITED_OR_JOINT_STOCK_COMPANY) - **memberExternalId** (string) - Üye dış ID değeri - **name** (string) - Üye ismi - **address** (string) - Üye adresi - **email** (string) - Üyeye ait email bilgisi - **iban** (string) - Üyeye ait iban bilgisi - **settlementEarningsDestination** (SettlementEarningsDestination) - Üye kazançları dağıtım yeri (IBAN, WALLET, CROSS_BORDER) - **phoneNumber** (string) - Üye telefon numarası - **taxOffice** (string) - Üye vergi dairesi - **taxNumber** (string) - Üye vergi no - **contactName** (string) - Üye ulaşılabilir kişi ismi - **contactSurname** (string) - Üye ulaşılabilir kişi soyismi - **legalCompanyTitle** (string) - Resmi şirket ismi - **subMerchantMaximumAllowedNegativeBalance** (number) - Satıcılar için eksi bakiye limiti - **settlementDelayCount** (number) - Satıcılar için blokaj gün süresi ``` -------------------------------- ### Initiate APM Payment with Node.js Source: https://developer.craftgate.io/api/payment/pay-with-apm Example of initializing an APM payment using the Craftgate Node.js SDK. ```javascript const Craftgate = require('@craftgate/craftgate'); const craftgate = new Craftgate.Client({ apiKey: 'YOUR_SANDBOX_API_KEY', secretKey: 'YOUR_SANDBOX_API_KEY', baseUrl: 'https://sandbox-api.craftgate.io' }); const request = { apmType: Craftgate.Model.ApmType.Papara, price: 1.0, paidPrice: 1.0, currency: Craftgate.Model.Currency.TRY, paymentGroup: Craftgate.Model.PaymentGroup.ListingOrSubscription, conversationId: '456d1297-908e-4bd6-a13b-4be31a6e47d5', callbackUrl: 'https://www.your-website.com/craftgate-apm-callback', items: [ { name: 'Item 1', price: 0.4, externalId: '123d1297-839e-4bd6-a13b-4be31a6e12a8' }, { name: 'Item 2', price: 0.6, externalId: '789d1297-839e-4bd6-a13b-4be31a6e13f7' } ] }; craftgate.payment().initApmPayment(request) .then(result => console.info('Init Apm payment successful', result)) .catch(err => console.error('Failed to init Apm payment', err)); ``` -------------------------------- ### Example Response JSON Source: https://developer.craftgate.io/api/payment/pay-with-apm A sample JSON response received from the callback containing status, payment details, and the hash. ```json { "status": "SUCCESS", "conversationId": "456d1297-908e-4bd6-a13b-4be31a6e47d5", "paymentId": 1, "callbackStatus": null, "hash": "3a3f520be02eaca2e689d1db855af3925cbdd8db5f850b2b9e61f7ccb9d997b4" } ``` -------------------------------- ### Example GarantiPay Callback Response Source: https://developer.craftgate.io/api/payment/payment-with-garantipay-v1 A sample JSON response received from the GarantiPay callback URL. ```json { "status": "SUCCESS", "conversationId": "456d1297-908e-4bd6-a13b-4be31a6e47d5", "paymentId": 1, "callbackStatus": null, "conversationData": null "hash": "3a3f520be02eaca2e689d1db855af3925cbdd8db5f850b2b9e61f7ccb9d997b4" } ``` -------------------------------- ### Search Installments with Node.js Source: https://developer.craftgate.io/api/installment-and-bin-inquiry/search-installments Use this snippet to search for available installments for a given BIN number and price. Ensure you have the Craftgate Node.js client installed and configured with your API keys. ```javascript const Craftgate = require('@craftgate/craftgate'); const craftgate = new Craftgate.Client({ apiKey: 'YOUR_SANDBOX_API_KEY', secretKey: 'YOUR_SANDBOX_API_KEY', baseUrl: 'https://sandbox-api.craftgate.io' }); // play with the request const request = { binNumber: '520922', price: 100, currency: Craftgate.Model.Currency.TRY }; craftgate.installment().searchInstallments(request) .then(result => console.info('Search installments', result)) .catch(err => console.error('Failed to search installments', err)); ``` -------------------------------- ### Initialize BNPL Payment with Node.js Source: https://developer.craftgate.io/api/bnpl-payments/init Demonstrates how to initialize a BNPL payment request using the Craftgate client. Requires valid sandbox API keys and configuration. ```javascript const Craftgate = require('@craftgate/craftgate'); const craftgate = new Craftgate.Client({ apiKey: 'YOUR_SANDBOX_API_KEY', secretKey: 'YOUR_SANDBOX_API_KEY', baseUrl: 'https://sandbox-api.craftgate.io' }); const request = { price: 10000, paidPrice : 10000, currency: Craftgate.Model.Currency.TRY, apmType : Craftgate.Model.ApmType.Maslak, apmOrderId: "456d1297-908e-4bd6-a13b-4be31a6e47d5", paymentGroup : Craftgate.Model.PaymentGroup.Product, conversationId : "29393-mXld92ko3", externalId : "external_id-345", callbackUrl : "callback", bankCode: "034", items: [ { externalId: "38983903", name: "item-1", price: 6000, }, { externalId: "92983294", name: "item-2", price: 4000, } ], cartItems: [ { id: "200", name: "Test Elektronik 2", brandName:"iphone", type: Craftgate.Model.BnplCartItemType.Other, unitPrice: 3000, quantity: 2, }, { id: "100", name: "Test Elektronik 1", brandName:"Samsung", type: Craftgate.Model.BnplCartItemType.Tv, unitPrice: 4000, quantity: 1, } ] }; craftgate.payment().initBnplPayment(request) .then(results => console.info('Init bnpl payment response', results)) .catch(err => console.error('Failed to Init bnpl payment', err)); ``` -------------------------------- ### Pre-Approved Credit Response Example Source: https://developer.craftgate.io/bnpl-payments/fingate This is an example response when querying for pre-approved credit. The `preApprovedApplicationId` field indicates a bank that offers pre-approved credit. If this field is absent for a bank, it does not support pre-approved credit. ```json { "data": { "bankOffers": [ { ... "bankCode": "012", "preApprovedApplicationId": "12345678", ... } ] } } ``` -------------------------------- ### GET /craftlink/v1/products Source: https://developer.craftgate.io/api/payment/payment-by-link-qr-code Searches for payment link products. ```APIDOC ## GET /craftlink/v1/products ### Description Searches for payment links. ### Method GET ### Endpoint /craftlink/v1/products ``` -------------------------------- ### GET /payment/retrievePayment Source: https://developer.craftgate.io/api/payment/retrieve-payment Retrieves the details of a specific payment transaction by its ID. ```APIDOC ## GET /payment/retrievePayment ### Description Retrieves the details of a specific payment transaction using the payment ID. ### Method GET ### Parameters #### Path Parameters - **paymentId** (number) - Required - The unique identifier of the payment to retrieve. ### Request Example ```javascript const Craftgate = require('@craftgate/craftgate'); const craftgate = new Craftgate.Client({ apiKey: 'YOUR_SANDBOX_API_KEY', secretKey: 'YOUR_SANDBOX_API_KEY', baseUrl: 'https://sandbox-api.craftgate.io' }); craftgate.payment().retrievePayment(1) .then(payment => console.info('Payment retrieved', payment)) .catch(err => console.error('Failed to retrieve payment', err)); ``` ### Response #### Success Response (200) - **fraudRuleId** (number) - The rule ID associated with the suspicious transaction. - **paymentTransactions** (PaymentTransaction[]) - Breakdown information regarding pricing and fund transfers. - **additionalData** (map) - Additional information related to the payment result. ``` -------------------------------- ### POST /payment/v1/mult-payments/init Source: https://developer.craftgate.io/api/payment/multi-payments Parçalı ödeme başlatma işlemini gerçekleştiren endpoint. ```APIDOC ## POST /payment/v1/mult-payments/init ### Description Parçalı ödeme başlatmak için kullanılan endpoint. ### Method POST ### Endpoint /payment/v1/mult-payments/init ``` -------------------------------- ### GET /wallet/v1/wallets/:id/wallet-transactions Source: https://developer.craftgate.io/api/wallet/search-wallet-transactions Search for wallet transactions associated with a specific wallet. ```APIDOC ## GET /wallet/v1/wallets/:id/wallet-transactions ### Description Searches for wallet transactions for a given wallet ID. Allows filtering by transaction type and pagination. ### Method GET ### Endpoint /wallet/v1/wallets/:id/wallet-transactions ### Parameters #### Path Parameters - **id** (number) - Required - The ID of the wallet to search transactions for. #### Query Parameters - **walletTransactionType** (WalletTransactionType) - Optional - The type of wallet transaction to filter by. Possible values include: PAYMENT_REDEEM, REFUND_DEPOSIT, WITHDRAW, REFUND_TX_DEPOSIT, CANCEL_REFUND_TO_WALLET, CANCEL_REFUND_WALLET_TO_CARD, REFUND_TX_TO_WALLET, REFUND_WALLET_TX_TO_CARD, MANUAL_REFUND_TX_TO_WALLET, SETTLEMENT_EARNINGS, DEPOSIT_FROM_CARD, REMITTANCE, LOYALTY, WITHDRAW_CANCEL, MERCHANT_BALANCE_RESET, DEPOSIT_FROM_FUND_TRANSFER. - **page** (number) - Optional - The page number for pagination. - **size** (number) - Optional - The number of results per page. ### Response #### Success Response (200) - **data** (object) - Contains the list of wallet transactions. - **id** (number) - The ID of the wallet transaction. - **createdDate** (date) - The date and time the wallet transaction was created. - **walletTransactionType** (WalletTransactionType) - The type of the wallet transaction. - **amount** (decimal) - The amount of the wallet transaction. - **transactionId** (number) - The ID of the transaction. - **walletId** (number) - The ID of the wallet. #### Response Example { "data": [ { "id": 123, "createdDate": "2023-10-27T10:00:00Z", "walletTransactionType": "DEPOSIT_FROM_CARD", "amount": 100.50, "transactionId": 456, "walletId": 789 } ] } ### Request Example ```javascript const Craftgate = require('@craftgate/craftgate'); const craftgate = new Craftgate.Client({ apiKey: 'YOUR_SANDBOX_API_KEY', secretKey: 'YOUR_SANDBOX_API_KEY', baseUrl: 'https://sandbox-api.craftgate.io' }); const request = { walletTransactionTypes: [Craftgate.Model.WalletTransactionType.DepositFromCard] }; // change wallet id below with valid wallet id craftgate.wallet().searchWalletTransactions(1, request) .then(result => console.info('Search wallet transactions', result)) .catch(err => console.error('Failed to search wallet transactions', err)); ``` ``` -------------------------------- ### GET /settlement/v1/payout-accounts Source: https://developer.craftgate.io/api/payout-account/search-payout-account Para gönderim hesaplarını aramak için kullanılan endpoint. ```APIDOC ## GET /settlement/v1/payout-accounts ### Description Para gönderim hesabı aramak için bu servisi kullanabilirsiniz. ### Method GET ### Endpoint /settlement/v1/payout-accounts ### Parameters #### Query Parameters - **currency** (Currency) - Optional - Hesabın para birimi (TRY, USD, EUR, GBP, CNY, ARS, BRL, AED, IQD, AZN, KZT, KWD, SAR, BHD, RUB, JPY, EGP) - **accountOwner** (PayoutAccountOwner) - Optional - Hesap sahibi (MERCHANT, SUB_MERCHANT_MEMBER) - **subMerchantMemberId** (number) - Optional - Hesap sahibi alt üye işyeri ise alt üye işyerinin üye id bilgisi - **page** (number) - Optional - Sayfalama için sayfa sayısı - **size** (number) - Optional - Sayfalama için sonuç sayısı ### Response #### Success Response (200) - **id** (number) - Hesap ID bilgisi - **type** (PayoutAccountType) - Hesap tipi (WISE) - **externalAccountId** (string) - İlgili hesaba ait id bilgisi - **currency** (Currency) - Ödemenin tahsil edileceği para birimi - **accountOwner** (PayoutAccountOwner) - Hesap sahibi - **subMerchantMemberId** (number) - Hesap sahibi alt üye işyeri ise alt üye id bilgisi ``` -------------------------------- ### POST /payment/init Source: https://developer.craftgate.io/api/payment/common-payment-page Ortak ödeme sayfası ile ödeme başlatmak için kullanılan uç nokta. Bu işlemde callbackUrl parametresi zorunludur. ```APIDOC ## POST /payment/init ### Description Ortak ödeme sayfası ile ödeme başlatma isteği oluşturur. Kart bilgileri bu aşamada gönderilmez, kullanıcı ortak ödeme sayfasına yönlendirilir. ### Method POST ### Parameters #### Request Body - **conversationId** (string) - Optional - İstekleri ilişkilendirmek için kullanılan bumerang değer. - **externalId** (string) - Optional - Üye işyeri sipariş veya sepet numarası. - **orderId** (string) - Optional - Bankaya iletilecek sipariş numarası. - **price** (decimal) - Required - Toplam ödeme tutarı. - **paidPrice** (decimal) - Required - Müşterinin ödeyeceği toplam tahsilat tutarı. - **buyerMemberId** (number) - Optional - Ödemenin ilişkilendirildiği alıcı ID'si. - **currency** (Currency) - Required - Ödemenin tahsil edileceği para birimi (TRY, USD, EUR, vb.). - **paymentGroup** (PaymentGroup) - Optional - Ödeme grubu (PRODUCT, LISTING_OR_SUBSCRIPTION). - **paymentPhase** (PaymentPhase) - Optional - Ödeme fazı (AUTH, PRE_AUTH, POST_AUTH). - **paymentChannel** (string) - Optional - Ödemenin alındığı kanal bilgisi. - **callbackUrl** (string) - Required - Ödeme tamamlandığında çağırılacak URL. - **cardUserKey** (string) - Optional - Kart kullanıcı anahtarı. - **enabledInstallments** (number[]) - Optional - Gösterilecek taksit seçenekleri. - **allowOnlyCreditCard** (boolean) - Optional - Sadece kredi kartı ile ödeme izni. - **allowOnlyStoredCards** (boolean) - Optional - Sadece saklı kartlar ile ödeme izni. - **alwaysStoreCardAfterPayment** (boolean) - Optional - Ödeme sonrası kartı saklama tercihi. - **allowDeleteStoredCard** (boolean) - Optional - Saklı kart silme aksiyonu gösterimi. - **allowInstallmentOnlyCommercialCards** (boolean) - Optional - Sadece ticari kartlara taksit gösterimi. - **forceAuthForNonCreditCards** (boolean) - Optional - Kredi kartı dışı kartlar için AUTH zorunluluğu. - **forceThreeDS** (boolean) - Optional - 3DS zorunluluğu. - **depositPayment** (boolean) - Optional - Cüzdan hesabına aktarım tercihi. - **ttl** (long) - Optional - İstek geçerlilik süresi (dakika). - **items** (PaymentItem[]) - Required - Ödeme kırılım bilgileri. - **masterpassGsmNumber** (string) - Optional - Masterpass telefon numarası. - **masterpassUserId** (string) - Optional - Masterpass kullanıcı ID. ``` -------------------------------- ### GET /merchant/v1/merchant-poses Source: https://developer.craftgate.io/api/merchant-pos/search Retrieves a list of POS terminals associated with the merchant account. ```APIDOC ## GET /merchant/v1/merchant-poses ### Description Retrieves a list of POS terminals associated with the merchant account based on provided query parameters. ### Method GET ### Endpoint /merchant/v1/merchant-poses ### Parameters #### Query Parameters - **name** (string) - Optional - Pos name - **alias** (string) - Optional - Defined alias for the POS - **currency** (Currency) - Optional - Supported currency (TRY, USD, EUR, GBP, CNY, ARS, BRL, AED, IQD, AZN, KZT, KWD, SAR, BHD, RUB, JPY, EGP) - **enabledInstallments** (boolean) - Optional - Whether installments are enabled - **enableForeignCard** (boolean) - Optional - Whether foreign cards are enabled - **bankName** (string) - Optional - Name of the bank ### Response #### Success Response (200) - **id** (number) - POS ID - **status** (Status) - POS status (ACTIVE, PASSIVE) - **name** (string) - POS name - **alias** (string) - POS alias - **posIntegrator** (string) - POS provider - **hostname** (string) - POS hostname - **clientId** (string) - Client ID - **posCurrencyCode** (string) - POS currency code - **mode** (string) - POS mode - **path** (string) - POS path - **posnetId** (string) - POSNET ID - **terminalId** (string) - Terminal ID - **threedsPosnetId** (string) - 3DS POSNET ID - **threedsTerminalId** (string) - 3DS Terminal ID - **threedsKey** (string) - 3DS key - **threedsPath** (string) - 3DS path - **forceThreeDs** (boolean) - Force 3DS value - **enableForeignCard** (boolean) - Enable foreign card - **enableInstallment** (boolean) - Enable installment - **enablePaymentWithoutCvc** (boolean) - Enable payment without CVC - **orderNumber** (number) - POS order number - **minPriceForInstallment** (number) - Minimum price for installment - **currency** (Currency) - Currency - **bankId** (number) - Bank ID - **bankName** (string) - Bank name - **merchantPosUsers** (object[]) - Merchant POS users - **supportedCardAssociations** (CardAssociation[]) - Supported card associations - **enabledPaymentAuthenticationTypes** (string[]) - Supported payment authentication types - **enabledPaymentPhases** (PaymentPhase[]) - Supported payment phases (AUTH, PRE_AUTH, POST_AUTH) ``` -------------------------------- ### POST /payment/init Source: https://developer.craftgate.io/api/payment/create-3d-secure-payment Initiates a payment process. For 3D Secure payments, the callbackUrl parameter is mandatory to receive the bank's response. ```APIDOC ## POST /payment/init ### Description Initiates a payment transaction. Includes support for 3D Secure, wallet payments, and installment options. ### Method POST ### Parameters #### Request Body - **conversationId** (string) - Optional - Unique identifier for correlating requests. - **externalId** (string) - Optional - Merchant's order or basket ID. - **price** (decimal) - Required - Total payment amount. - **paidPrice** (decimal) - Required - Final amount to be charged to the card. - **walletPrice** (decimal) - Required - Amount to be deducted from the buyer's wallet. - **installment** (number) - Required - Number of installments. - **buyerMemberId** (number) - Optional - Craftgate buyer ID. - **currency** (Currency) - Required - Currency code (e.g., TRY, USD). - **paymentGroup** (PaymentGroup) - Optional - Payment group (PRODUCT, LISTING_OR_SUBSCRIPTION). - **paymentPhase** (PaymentPhase) - Optional - Payment phase (AUTH, PRE_AUTH, POST_AUTH). - **paymentChannel** (string) - Optional - Payment channel identifier. - **callbackUrl** (string) - Required (for 3D Secure) - URL for receiving 3D Secure results. - **bankOrderId** (string) - Optional - Bank order ID. - **clientIp** (string) - Optional - Buyer's IPv4 address. - **card** (Card) - Optional - Card information. - **posAlias** (string) - Optional - Alias of the POS to be used. - **retry** (boolean) - Optional - Whether to retry on failure (Default: true). - **fraudParams** (FraudCheckParameters) - Optional - Fraud control parameters. - **items** (PaymentItem[]) - Required - Payment breakdown items. - **additionalParams** (map) - Optional - Additional custom parameters. ### Response #### Success Response (200) - **htmlContent** (string) - Base64 encoded HTML for 3D Secure form. - **paymentId** (number) - Unique payment ID. - **redirectUrl** (string) - URL for continuing the payment process. - **paymentStatus** (PaymentStatus) - Status of the payment (e.g., SUCCESS, INIT_THREEDS). - **additionalAction** (AdditionalAction) - Next action required (e.g., SHOW_HTML_CONTENT). ``` -------------------------------- ### Node.js ile Üye Cüzdanından Para Çekme Source: https://developer.craftgate.io/api/wallet/receive-remittance Craftgate Node.js istemcisini kullanarak cüzdandan para çekme isteği oluşturma örneği. ```javascript const Craftgate = require('@craftgate/craftgate'); const craftgate = new Craftgate.Client({ apiKey: 'YOUR_SANDBOX_API_KEY', secretKey: 'YOUR_SANDBOX_API_KEY', baseUrl: 'https://sandbox-api.craftgate.io' }); const request = { memberId: 1, // change it with a valid member id price: 50, description: 'Remittance received from memberId 1', remittanceReasonType: Craftgate.Model.RemittanceReasonType.RedeemOnlyLoyalty }; craftgate.wallet().receiveRemittance(request) .then(result => console.info('Remittance received', result)) .catch(err => console.error('Failed to receive remittance', err)); ``` -------------------------------- ### GET /fraud/v1/value-lists Source: https://developer.craftgate.io/api/fraud-management/retrieve-all-lists Retrieves a list of all fraud value lists configured in the system. ```APIDOC ## GET /fraud/v1/value-lists ### Description Retrieves all fraud value lists. ### Method GET ### Endpoint /fraud/v1/value-lists ### Response #### Success Response (200) - **data** (object) - The returned object containing the list details: - **name** (string) - List name - **values** (FraudValue[]) - List of values - **id** (string) - Value Id - **label** (string) - Label - **value** (string) - Value - **expireInSeconds** (number) - Expiration time in seconds ### Request Example ```javascript const Craftgate = require('@craftgate/craftgate'); const craftgate = new Craftgate.Client({ apiKey: 'YOUR_SANDBOX_API_KEY', secretKey: 'YOUR_SANDBOX_API_KEY', baseUrl: 'https://sandbox-api.craftgate.io' }); craftgate.fraud().retrieveAllValueLists() .then(result => console.info('Retrieved all fraud value lists results', result)) .catch(err => console.error('Failed to retrieve all fraud value lists results', err)); ``` ``` -------------------------------- ### BKM Express Payment Initiation Source: https://developer.craftgate.io/api/payment/bkm_express Initiates a payment using the BKM Express service. This example demonstrates how to set up the request with payment details and items. ```APIDOC ## BKM Express Payment Initiation ### Description Initiates a payment using the BKM Express service. This example demonstrates how to set up the request with payment details and items. ### Method POST ### Endpoint /payment/v1/bkmexpress/initiate ### Parameters #### Request Body - **price** (decimal) - Required - The total price of the payment. - **paidPrice** (decimal) - Required - The amount that will be paid. - **conversationId** (string) - Required - Unique identifier for the conversation. - **currency** (Currency) - Required - The currency of the payment (e.g., TRY, USD, EUR). - **paymentGroup** (PaymentGroup) - Required - The group of the payment (e.g., PRODUCT, LISTING_OR_SUBSCRIPTION). - **items** (Array) - Required - A list of items included in the payment. - **name** (string) - Required - The name of the item. - **price** (decimal) - Required - The price of the item. - **externalId** (string) - Required - The external identifier for the item. ### Request Example ```json { "price": 100.0, "paidPrice": 100.0, "conversationId": "456d1297-908e-4bd6-a13b-4be31a6e47d5", "currency": "TRY", "paymentGroup": "ListingOrSubscription", "items": [ { "name": "Item 1", "price": 30.0, "externalId": "123d1297-839e-4bd6-a13b-4be31a6e12a8" }, { "name": "Item 2", "price": 50.0, "externalId": "789d1297-839e-4bd6-a13b-4be31a6e13f7" }, { "name": "Item 3", "price": 20.0, "externalId": "3a1d1297-839e-4bd6-a13b-4be31a6e18e6" } ] } ``` ### Response #### Success Response (200) - **id** (number) - The unique ID of the payment. - **createdDate** (date) - The date the payment was created. - **price** (decimal) - The total price of the payment. - **paidPrice** (decimal) - The amount actually paid. - **walletPrice** (decimal) - The amount paid from the wallet. - **currency** (Currency) - The currency of the payment. - **buyerMemberId** (number) - The ID of the buyer member. - **installment** (number) - The number of installments. - **conversationId** (string) - The conversation ID. - **paymentType** (PaymentType) - The type of payment. - **paymentGroup** (PaymentGroup) - The group of the payment. - **paymentSource** (PaymentSource) - The source of the payment. - **paymentProvider** (PaymentProvider) - The payment provider. - **paymentStatus** (PaymentStatus) - The status of the payment. - **paymentPhase** (PaymentPhase) - The phase of the payment. - **isThreeDS** (boolean) - Indicates if 3D Secure was used. - **merchantCommissionRate** (decimal) - The merchant commission rate. - **merchantCommissionRateAmount** (decimal) - The merchant commission rate amount. - **bankCommissionRate** (decimal) - The bank commission rate. - **bankCommissionRateAmount** (decimal) - The bank commission rate amount. - **paidWithStoredCard** (boolean) - Indicates if a stored card was used. - **binNumber** (string) - The first 8 digits of the card number. - **lastFourDigits** (string) - The last 4 digits of the card number. - **cardHolderName** (string) - The name of the cardholder. - **bankCardHolderName** (string) - The cardholder name as registered with the bank. - **authCode** (string) - The authorization code from the bank. - **hostReference** (string) - The host reference from the bank. - **transId** (string) - The transaction ID from the bank. - **orderId** (string) - The order ID from the bank. - **cardType** (CardType) - The type of the card. - **cardAssociation** (CardAssociation) - The card association. - **cardBrand** (string) - The brand of the card. - **pos** (Object) - Information about the point of sale. - **paymentTransactions** (Array) - Details of payment transactions. #### Response Example ```json { "data": { "id": 123456789, "createdDate": "2023-10-27T10:00:00.000Z", "price": 100.0, "paidPrice": 100.0, "walletPrice": 0.0, "currency": "TRY", "buyerMemberId": 987654321, "installment": 1, "conversationId": "456d1297-908e-4bd6-a13b-4be31a6e47d5", "paymentType": "CARD_PAYMENT", "paymentGroup": "PRODUCT", "paymentSource": "API", "paymentProvider": "BKM_EXPRESS", "paymentStatus": "SUCCESS", "paymentPhase": "POST_AUTH", "isThreeDS": false, "merchantCommissionRate": 0.0, "merchantCommissionRateAmount": 0.0, "bankCommissionRate": 0.0, "bankCommissionRateAmount": 0.0, "paidWithStoredCard": false, "binNumber": "12345678", "lastFourDigits": "1234", "cardHolderName": "John Doe", "bankCardHolderName": "John Doe", "authCode": "123456", "hostReference": "ABCDEF123456", "transId": "XYZ789", "orderId": "ORDER123", "cardType": "CREDIT_CARD", "cardAssociation": "VISA", "cardBrand": "Visa", "pos": {}, "paymentTransactions": [] } } ``` ``` -------------------------------- ### GET /craftlink/v1/products/:id Source: https://developer.craftgate.io/api/payment/payment-by-link-qr-code Retrieves details of a specific payment link product by its ID. ```APIDOC ## GET /craftlink/v1/products/:id ### Description Retrieves information about a specific payment link. ### Method GET ### Endpoint /craftlink/v1/products/:id ### Parameters #### Path Parameters - **id** (number) - Required - Link's ID value ``` -------------------------------- ### POST /payment/v2/masterpass-payments/3ds-init Source: https://developer.craftgate.io/api/payment/payment-with-masterpass Initializes a 3D Secure Masterpass payment process. ```APIDOC ## POST /payment/v2/masterpass-payments/3ds-init ### Description Initializes the 3D Secure payment flow for Masterpass transactions. ### Method POST ### Endpoint /payment/v2/masterpass-payments/3ds-init ### Parameters #### Request Body - **referenceId** (string) - Required - The value returned in the token creation response for the transaction. - **callbackUrl** (string) - Required - The URL used to transmit the 3D Secure verification result to the merchant. ### Response #### Success Response (200) - **paymentId** (number) - The ID of the payment, used in the 3DS complete phase for mobile flows. - **returnUrl** (string) - The URL for user redirection (web) or the URL to be set in resultUrl3D (mobile). ``` -------------------------------- ### GET /payment-reporting/v1/payments Source: https://developer.craftgate.io/api/payment-reports/search-payments Geçmişte yapılmış tüm ödemeleri sorgulamak için kullanılan endpoint. ```APIDOC ## GET /payment-reporting/v1/payments ### Description Geçmişte yapılmış başarılı ya da başarısız tüm ödemeler Craftgate API kullanılarak sorgulanabilir. ### Method GET ### Endpoint /payment-reporting/v1/payments ### Parameters #### Query Parameters - **paymentId** (number) - Ödemenin id bilgisi - **paymentTransactionId** (number) - Ödeme kırılımının id bilgisi - **buyerMemberId** (number) - Alıcı üyenin ID'si - **subMerchantMemberId** (number) - Ödeme kırılımının ilişkili olduğu satıcı ID'si - **conversationId** (string) - Üye işyeri tarafından gönderilen conversationId - **externalId** (string) - Üye işyeri tarafından gönderilen externalId - **merchantPosId** (number) - Ödemenin geçtiği posun id bilgisi - **orderId** (string) - Banka tarafından verilen orderId değeri - **paymentType** (PaymentType) - Ödeme tipi (CARD_PAYMENT, DEPOSIT_PAYMENT, WALLET_PAYMENT, CARD_AND_WALLET_PAYMENT, BANK_TRANSFER, APM) - **paymentStatus** (PaymentStatus) - Ödeme durumu (FAILURE, SUCCESS, INIT_THREEDS, CALLBACK_THREEDS, WAITING) - **paymentChannel** (string) - Üye işyeri tarafından gönderilen paymentChannel - **binNumber** (string) - Kartın ilk 8 hanesi - **lastFourDigits** (string) - Kartın son 4 hanesi - **currency** (string) - Para birimi (TRY, USD, EUR, GBP, vb.) - **minPaidPrice** (decimal) - Minimum tutar - **maxPaidPrice** (decimal) - Maksimum tutar - **installment** (number) - Taksit sayısı - **isThreeDS** (boolean) - 3D Secure durumu - **minCreatedDate** (date) - Minimum tarih - **maxCreatedDate** (date) - Maksimum tarih - **page** (number) - Sayfa sayısı - **size** (number) - Sonuç sayısı ```