Better Payment 0.11.1 API
    Preparing search index...

    Class Iyzico

    iyzico payment provider

    Hierarchy (View Summary)

    Index
    • Capture of a pre-authorization (/payment/postauth). amount becomes the charged paidPrice; a lower amount is a partial capture.

      Parameters

      • request: CaptureRequest

      Returns Promise<PaymentResponse>

    • Completes a 3D Secure payment.

      The callback POST is not signed, so its values are untrusted: only the response of /payment/3dsecure/auth decides the result. paymentId and conversationId are set from iyzico's response of a successful payment only; a failure never carries ids taken from the request, so a forged callback cannot name an existing order.

      Parameters

      • callbackData: IyzicoThreeDSCallbackData

      Returns Promise<PaymentResponse>

    • Deletes a saved card (DELETE /cardstorage/card)

      Parameters

      • request: DeleteCardRequest

      Returns Promise<DeleteCardResponse>

    • Initialize a PWI payment

      Initializes a protected bank transfer. The customer sees an IBAN and payment details. After the customer makes the transfer, the funds are sent to the merchant once approved.

      Parameters

      Returns Promise<PWIPaymentInitResponse>

      PWI initialization response (HTML content, token, payment page URL)

      const result = await iyzico.initPWIPayment({
      price: '100.00',
      paidPrice: '100.00',
      currency: Currency.TRY,
      basketId: 'B67832',
      callbackUrl: 'https://your-site.com/payment/callback',
      buyer: { ... },
      shippingAddress: { ... },
      billingAddress: { ... },
      basketItems: [ ... ]
      });

      if (result.status === 'success') {
      // Option 1: Display the HTML content
      document.body.innerHTML = result.htmlContent;

      // Option 2: Redirect to the payment page
      window.location.href = result.paymentPageUrl;
      }
    • Query installment options

      Queries available installment options for a given BIN and amount. Shows installment rates and total amounts for each bank.

      Parameters

      Returns Promise<InstallmentInfoResponse>

      Installment options and details

      const result = await iyzico.installmentInfo({
      binNumber: '552879',
      price: '100.00'
      });

      if (result.status === 'success' && result.installmentDetails) {
      result.installmentDetails.forEach(detail => {
      console.log(`Bank: ${detail.bankName}`);
      console.log(`Card family: ${detail.cardFamilyName}`);
      detail.installmentPrices.forEach(installment => {
      console.log(`${installment.installmentNumber} installments: ${installment.totalPrice} TL (Per installment: ${installment.installmentPrice} TL)`);
      });
      });
      }
    • A customer's saved cards (/cardstorage/cards)

      Parameters

      • request: { conversationId?: string; customerToken: string }

      Returns Promise<ListCardsResponse>

    • Refund. With paymentId alone, refunds an amount of the whole payment (/v2/payment/refund). With paymentTransactionId, refunds that basket item (/payment/refund).

      Parameters

      Returns Promise<RefundResponse>

    • Query the Checkout Form result

      Parameters

      • token: string
      • OptionalconversationId: string

      Returns Promise<CheckoutFormRetrieveResponse>

    • Query a PWI payment

      Queries the status of an initialized PWI payment. Returns payment details if the transfer was made, otherwise the IBAN and bank details.

      Parameters

      • token: string

        PWI payment token (returned by initPWIPayment)

      • OptionalconversationId: string

        Optional conversation ID

      Returns Promise<PWIPaymentRetrieveResponse>

      PWI payment status and details

      const result = await iyzico.retrievePWIPayment(token);

      if (result.status === 'success') {
      if (result.paymentStatus === 'SUCCESS') {
      console.log('Payment succeeded:', result.paymentId);
      } else if (result.paymentStatus === 'WAITING') {
      console.log('Awaiting bank transfer');
      console.log('IBAN:', result.iban);
      console.log('Bank:', result.bankName);
      }
      }
    • Saves a card without charging it (/cardstorage/card). Omit customerToken to create a new customer (cardUserKey).

      Parameters

      • request: SaveCardRequest

      Returns Promise<SaveCardResponse>

    • Releases a pre-authorization: iyzico voids it with /payment/cancel

      Parameters

      • request: VoidAuthorizationRequest

      Returns Promise<CancelResponse>