Skip to main content

A Nmi library for python

Project description

NMI Gateway

This is a nmi handy package to interact with the nmi gateway endpoints, you can find the original documentation here: https://secure.networkmerchants.com/gw/merchants/resources/integration/integration_portal.php#cv_variables

This package was build with the unique intention to make the integration with the gateway easy.

Examples

Customer Vault methods

Create customer vault

from nmigate.lib.customer_vault import CustomerVault

secret_key = 'your secret key'
org = 'your org'
token = 'your test token here' # test token "00000000-000000-000000-000000000000"

customer_vault = CustomerVault(secret_key, org)
        result = customer_vault.create_customer_vault({
            "id": "51asdfsf234asdfasfasfsa",
            "token": token,
            "billing_id": "51asdfsf234asdfasfasfsa",
            "billing_info": {
                "first_name": "1",
                "last_name": "1",
                "address1": "1",
                "city": "1",
                "state": "1",
                "zip": "1",
                "country": "1",
                "phone": "1",
                "email": "1"
            }
        })

Get billing info by transaction id

from nmigate.lib.customer_vault import CustomerVault

secret_key = 'your secret key'
org = 'your org'
transaction_id = 'transaction id '

customer_vault = CustomerVault(secret_key, org)
result = customer_vault.get_billing_info_by_transaction_id(transaction_id)

Subscriptions

Get Subscriptions

from nmigate.lib.customer_vault import CustomerVault

secret_key = 'your secret key'
org = 'your org'
subscription_id='customer vault id'

subscriptions = Subscriptions(secret_key, org)
info = subscriptions.get_info(subscription_id)
print(result)

Subscription + sale, using plan_id and customer vault

If total_amount = 0 then its a simple subscription, if total_amount > 0 then its a subscription with sale

from nmigate.lib.customer_vault import CustomerVault

secret_key = 'your secret key'
org = 'your org'
customer_vault_id='customer vault id'

subscriptions = Subscriptions(secret_key, org)
result = subscriptions.custom_sale_using_vault(plan_id = customer_vault_id, customer_vault_id=customer_vault_id, create_customer_vault=False)
print(result)

Custome Subscription + sale, using vault number and month frequency configuration

from nmigate.lib.subscriptions import Subscriptions

secret_key = 'your secret key'
org = 'your org'

subscriptions = Subscriptions(secret_key, org)
result = subscriptions.custom_sale_using_vault_month_frequency(request_sub = {
    "user_id": "1",
    "total_amount": "11",
    "custom_subscription_info": {
        "plan_payments": "13",
        "plan_amount": "12",
        "month_frequency": "1",
        "day_of_month": "1"
    }
})
print(result)

Custome Subscription + sale, using vault number and day frequency configuration

from nmigate.lib.subscriptions import Subscriptions

secret_key = 'your secret key'
org = 'your org'

subscriptions = Subscriptions(secret_key, org)
result = subscriptions.custom_with_sale_and_vault_day_frequency(request_sub = {
    "user_id": "1",
    "total_amount": "14",
    "custom_subscription_info": {
        "plan_payments": "15",
        "plan_amount": "6",
        "day_frequency": "1"
    }
})
print(result)

Delete subscription

from nmigate.lib.subscriptions import Subscriptions

secret_key = 'your secret key'
org = 'your org'
subscription_id = 'your subscription_id'

subscriptions = Subscriptions(secret_key, org)
info = subscriptions.delete_subscription(subscription_id)

Pause Subscription

from nmigate.lib.subscriptions import Subscriptions

secret_key = 'your secret key'
org = 'your org'
subscription_id = 'your subscription_id'
pause=True # True to pause, False to unpause

transactions = Subscriptions(secret_key, org)
result = transactions.pause_subscription(subscription_id, pause)

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

nmigate-0.0.5.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

nmigate-0.0.5-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file nmigate-0.0.5.tar.gz.

File metadata

  • Download URL: nmigate-0.0.5.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for nmigate-0.0.5.tar.gz
Algorithm Hash digest
SHA256 f9390ffdc8f846c998d5c577479dd29a4ecfaf6b7427c0d29ed49ed449af01a0
MD5 328e1202feacb10462493c3292e90300
BLAKE2b-256 397f06a79f6d77f2d2f1ef4b0f45216a203e9ea4391614664675a4ec2f660387

See more details on using hashes here.

File details

Details for the file nmigate-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: nmigate-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for nmigate-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2268ea0800878d3d97c295e9b8211fd73f450b8d5d952cecd01433601b2a0c28
MD5 3c53fee37e1fb6f37fe1bb59ca4448fb
BLAKE2b-256 2568d1849e2613d03bd6f4f440fdd57c61ea7af6a47b212c2d1f8d76fe991d2b

See more details on using hashes here.

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