Skip to main content

Saleor PostFinance gateway plugin.

Project description

Saleor PostFinance plugin

PostFinance gateway plugin for Saleor. This is a partially implementation, it only supports PostFinance payment page integration and it does not support refunds and void payments.

Setup PostFinance Plugin

  1. Navigate to Saleor Dashboard configuration and go to Plugins (Miscellaneous)
  2. Select the channel where you want to activate the plugin, fill in the settings and set the plugin as active. (Keep in mind some payment methods used in PostFinance (ex: Twint) will only support with CHF currency.)

Steps to use the plugin

  1. Create a checkout using the channel where the plugin is active.
mutation checkoutCreate {
    checkoutCreate(
        input: {
            channel: "switzerland-channel-example",
            email: ...,
            shippingAddress: ...,
            lines: [{quantity: 1, variantId: "UHJvZHVjdFZhcmlhbnQ6Mzg0"}]
        }
    ) {
        checkout {
            id
        }
    }
}
  1. Set checkout delivery method and set checkout billing address, for that you can use checkoutDeliveryMethodUpdate and checkoutBillingAddressUpdate mutations.

  2. Create checkout payment with PostFinance gateway ("significa.payments.postfinance")

mutation checkoutPaymentCreate {
    checkoutPaymentCreate(
        id: "Q2hlY2tvdXQ6NTE3M2ViNzAtNjMxOC00YzA3LTgwYzktY2VlNjkyMTdjZGE2",
        input: {
            gateway: "significa.payments.postfinance",
        }
    ) {
        payment {
            id
        }
    } 
}
  1. Call completeCheckout mutation with the following payment data, to get the PostFinance payment url.
mutation checkoutComplete {
  checkoutComplete(
    id: "Q2hlY2tvdXQ6NTE3M2ViNzAtNjMxOC00YzA3LTgwYzktY2VlNjkyMTdjZGE2",
    paymentData:"{\"successUrl\": \"https://example.com/success?checkout_id=Q2hlY2tvdXQ6NTE3M2ViNzAtNjMxOC00YzA3LTgwYzktY2VlNjkyMTdjZGE2\", \"failUrl\": \"https://example.com/fail?checkout_id=Q2hlY2tvdXQ6NTE3M2ViNzAtNjMxOC00YzA3LTgwYzktY2VlNjkyMTdjZGE2\"}"
  ) {
    confirmationNeeded
    confirmationData
  }
}

# Response
{
  "data": {
    "checkoutComplete": {
      "confirmationNeeded": true,
      "confirmationData": "{\"payment_page_url\": \"https://checkout.postfinance.ch/s/00000/payment/transaction/pay/10000000?securityToken=example-00000\"}",
    }
  }
}
  1. Finally call checkoutComplete to confirm the payment was captured successfully.
mutation checkoutComplete {
  checkoutComplete(
    id: "Q2hlY2tvdXQ6NTE3M2ViNzAtNjMxOC00YzA3LTgwYzktY2VlNjkyMTdjZGE2",
  ) {
    confirmationNeeded
    confirmationData
  }
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

saleor-postfinance-plugin-0.0.2.tar.gz (5.1 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page