{"id":28409263,"url":"https://github.com/paymentwall/paymentwall-java","last_synced_at":"2025-06-25T00:31:50.401Z","repository":{"id":24826624,"uuid":"28241194","full_name":"paymentwall/paymentwall-java","owner":"paymentwall","description":"Paymentwall Java Library","archived":false,"fork":false,"pushed_at":"2022-12-06T00:42:37.000Z","size":80,"stargazers_count":17,"open_issues_count":2,"forks_count":12,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-06-09T04:35:39.728Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paymentwall.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-19T18:29:21.000Z","updated_at":"2025-02-12T11:23:06.000Z","dependencies_parsed_at":"2023-01-14T01:40:46.468Z","dependency_job_id":null,"html_url":"https://github.com/paymentwall/paymentwall-java","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/paymentwall/paymentwall-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paymentwall%2Fpaymentwall-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paymentwall%2Fpaymentwall-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paymentwall%2Fpaymentwall-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paymentwall%2Fpaymentwall-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paymentwall","download_url":"https://codeload.github.com/paymentwall/paymentwall-java/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paymentwall%2Fpaymentwall-java/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261782304,"owners_count":23208902,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-02T06:18:00.659Z","updated_at":"2025-06-25T00:31:50.392Z","avatar_url":"https://github.com/paymentwall.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# About Paymentwall\n[Paymentwall](https://www.paymentwall.com/?source=gh) is the leading global payments platform.\n\nMerchants can plugin Paymentwall's API to accept payments from over 150 different methods including credit cards, debit cards, bank transfers, SMS/Mobile payments, prepaid cards, eWallets, landline payments and others. \n\nTo sign up for a Paymentwall Merchant Account, [click here](https://www.paymentwall.com/signup/merchant?source=gh).\n\n# Paymentwall Java Library\nThis library allows developers to use [Paymentwall APIs](https://docs.paymentwall.com/?source=gh) (Digital Goods API, Cart API, Brick API, Virtual Currency API).\n\nTo use Paymentwall, all you need to do is to sign up for a Paymentwall Merchant Account so you can setup an Application designed for your site.\nTo open your merchant account and set up an application, you can [sign up here](https://www.paymentwall.com/signup/merchant?source=gh).\n\n# Installation\nTo install the library in your environment, you can download the [ZIP archive](https://github.com/paymentwall/paymentwall-java/archive/master.zip), unzip it and place into your project.\n\nAlternatively, you can run:\n\n    git clone git://github.com/paymentwall/paymentwall-java.git\n\nThen use a code samples below.\n# Code Samples\n\n## Adding Paymentwall to your project using Apache Maven\n\n    \u003cdependencies\u003e\n\t\t\u003cdependency\u003e\n\t\t\t\u003cgroupId\u003ecom.paymentwall\u003c/groupId\u003e\n\t\t\t\u003cartifactId\u003epaymentwall-java\u003c/artifactId\u003e\n\t\t\t\u003cversion\u003e2.0.4\u003c/version\u003e\n\t\t\u003c/dependency\u003e\n    \u003c/dependencies\u003e\n\n## Digital Goods API\n\n#### Initializing Paymentwall\n\n    import com.paymentwall.java.*;\n\t\n\tConfig.getInstance().setLocalApiType(Config.API_GOODS);\n\tConfig.getInstance().setPublicKey(\"YOUR_APPLICATION_KEY\");\n\tConfig.getInstance().setPrivateKey(\"YOUR_SECRET_KEY\");\n\n#### Widget Call\n\n[Checkout API details](https://docs.paymentwall.com/integration/checkout-home)\n\nThe widget is a payment page hosted by Paymentwall that embeds the entire payment flow: selecting the payment method, completing the billing details, and providing customer support via the Help section. You can redirect the users to this page or embed it via iframe. Below is an example that renders an iframe with Paymentwall Widget.\n\n    WidgetBuilder widgetBuilder = new WidgetBuilder(\"user12345\", \"pw\");\n\twidgetBuilder.setProduct(\n\t\tnew ProductBuilder(\"product301\") {{\n\t\t\tsetAmount(0.99);\n\t\t\tsetCurrencyCode(\"USD\");\n\t\t\tsetName(\"100 coins\");\n\t\t\tsetProductType(Product.TYPE_FIXED);\n\t\t}}.build()\n\t);\n\twidgetBuilder.setExtraParams(\n\t\tnew LinkedHashMap\u003cString, String\u003e() {{\n\t\t\tput(\"email\", \"user@hostname.com\");\n\t\t}}\n\t);\n\tWidget w = widgetBuilder.build();\n\treturn w.getHtmlCode();\n\n#### Pingback Processing\n\nThe Pingback is a webhook notifying about a payment being made. Pingbacks are sent via HTTP/HTTPS to your servers. To process pingbacks use the following code:\n\n    Pingback pingback = new Pingback(request.getParameterMap(), request.getRemoteAddr());\n\tif (pingback.validate()) {\n\t\tString goods = pingback.getProductId();\n\t\tString userId = pingback.getUserId();\n\t\tif (pingback.isDeliverable()) {\n\t\t\t// deliver Product to user with userId\n\t\t} else if (pingback.isCancelable()) {\n\t\t\t// withdraw Product from user with userId\n\t\t}\n\t\treturn \"OK\";\n\t} else\n\t\treturn pingback.getErrorSummary();\n\n## Virtual Currency API\n\n#### Initializing Paymentwall\n\n    import com.paymentwall.java.*;\n    \n    Config.getInstance().setLocalApiType(Config.API_VC);\n    Config.getInstance().setPublicKey(\"YOUR_APPLICATION_KEY\");\n    Config.getInstance().setPrivateKey(\"YOUR_SECRET_KEY\");\n\n#### Widget Call\n\n    WidgetBuilder widgetBuilder = new WidgetBuilder(\"user12345\",\"p1_1\");\n\twidgetBuilder.setExtraParams(\n\t\tnew LinkedHashMap\u003cString, String\u003e() {{\n\t\t\tput(\"email\", \"user@hostname.com\");\n\t\t}}\n\t);\n\tWidget w = widgetBuilder.build();\n    return w.getHtmlCode();\n\n#### Pingback Processing\n\n    Pingback pingback = new Pingback(request.getParameterMap(), request.getRemoteAddr());\n\tif (pingback.validate()) {\n\t\tInteger currency = pingback.getVirtualCurrencyAmount();\n\t\tString userId = pingback.getUserId();\n\t\tif (pingback.isDeliverable()) {\n\t\t\t// deliver Product to user with userId\n\t\t} else if (pingback.isCancelable()) {\n\t\t\t// withdraw Product from user with userId\n\t\t}\n\t\treturn \"OK\";\n\t} else\n\t\treturn pingback.getErrorSummary();\n\n## Cart API\n\n#### Initializing Paymentwall\n\n    import com.paymentwall.java.*;\n\t\n    Config.getInstance().setLocalApiType(Config.API_CART);\n    Config.getInstance().setPublicKey(\"YOUR_APPLICATION_KEY\");\n    Config.getInstance().setPrivateKey(\"YOUR_SECRET_KEY\");\n\n\nYou have to set up your products in merchant area for exact regions first in order to use widget call example code below.\n\n    WidgetBuilder widgetBuilder = new WidgetBuilder(\"user12345\",\"p1_1\");\n\twidgetBuilder.setExtraParams(\n\t\tnew LinkedHashMap\u003cString, String\u003e() {{\n\t\t\tput(\"email\", \"user@hostname.com\");\n\t\t}}\n\t);\n\twidgetBuilder.setProducts(new ArrayList\u003cProduct\u003e(){{\n\t\tadd(\n\t\t\tnew ProductBuilder(\"product1\") {{\n\t\t\t\tsetAmount(9.99);\n\t\t\t\tsetCurrencyCode(\"USD\");\n\t\t\t\tsetName(\"Product 1\");\n\t\t\t}}.build()\n\t\t);\n\t\tadd(\n\t\t\tnew ProductBuilder(\"product2\"){{\n\t\t\t\tsetAmount(1);\n\t\t\t\tsetCurrencyCode(\"USD\");\n\t\t\t\tsetName(\"Product 2\");\n\t\t\t}}.build()\n\t\t);\n\t}});\n\tWidget w = widgetBuilder.build();\n    return w.getHtmlCode();\n\n#### Pingback Processing\n\n    Pingback pingback = new Pingback(request.getParameterMap(), request.getRemoteAddr());\n\tif (pingback.validate()) {\n\t\tArrayList\u003cProduct\u003e goods = pingback.getProducts();\n\t\tString userId = pingback.getUserId();\n\t\tif (pingback.isDeliverable()) {\n\t\t\t// deliver Product to user with userId\n\t\t} else if (pingback.isCancelable()) {\n\t\t\t// withdraw Product from user with userId\n\t\t}\n\t\treturn \"OK\";\n\t} else\n\t\treturn pingback.getErrorSummary();\n\n## Brick\n\n#### Initializing Paymentwall\n\n    Config.getInstance().setPublicKey(\"YOUR_APPLICATION_KEY\");\n    Config.getInstance().setPrivateKey(\"YOUR_SECRET_KEY\");\n\n#### Create a one-time token\n\n\tOneTimeToken token = new OneTimeToken();\n\ttoken = (OneTimeToken) token.create(new LinkedHashMap\u003cString, String\u003e(){{\n\t\tput(\"public_key\", Config.getInstance().getPublicKey());\n\t\tput(\"card[number]\", \"4242424242424242\");\n\t\tput(\"card[exp_month]\", \"11\");\n\t\tput(\"card[exp_year]\", \"19\");\n\t\tput(\"card[cvv]\", \"123\");\n\t}});\n\treturn token.getToken();\n\n#### Charge\n\n\tCharge charge = new Charge();\n\tcharge = (Charge)charge.create(new HashMap\u003cString, String\u003e(){{\n\t\tput(\"token\", token.getToken());\n\t\tput(\"email\", \"email@example.com\");\n\t\tput(\"currency\", \"USD\");\n\t\tput(\"amount\", \"10.99\");\n\t\t// if you receive one-time token and make charge on same server, then use \n\t\t// put(\"fingerprint\", request.getParameter(\"fingerprint\"));\n\t\t// instead of next 2 lines\n\t\tput(\"browser_domain\", request.getHeader(\"VIA\"));\n\t\tput(\"browser_ip\", request.getRemoteAddr());\n\t\tput(\"description\", \"description\");\n\t}});\n\n\tJSONObject response = charge.getPublicData();\n\tif (charge.isSuccessful()) \n\t\tif (charge.isCaptured()) {\n\t\t\t//deliver a product\n\t\t} else if (charge.isUnderReview()) {\n\t\t\t//decide on risk charge\n\t\t}\n\treturn response.toString(); // need for JS communication\n\n#### Charge - refund\n\n\tCharge charge = new Charge(\"CHARGE_ID\");\n\tcharge = (Charge)charge.refund();\n\treturn charge.isRefunded();\n\n#### Subscription\n\n\tSubscription subscription = new Subscription();\n\tsubscription = (Subscription) subscription.create( new HashMap\u003cString, String\u003e() {{\n\t\tput(\"token\" , token.getToken());\n\t\tput(\"email\", \"email@example.com\");\n\t\tput(\"currency\", \"USD\");\n\t\tput(\"amount\", \"10.99\");\n\t\t// if you receive one-time token and make charge on same server, then use \n\t\t// put(\"fingerprint\", request.getParameter(\"fingerprint\"));\n\t\t// instead of next 2 lines\n\t\tput(\"browser_domain\", request.getHeader(\"VIA\"));\n\t\tput(\"browser_ip\", request.getRemoteAddr());\n\t\tput(\"description\", \"description\");\n\t\tput(\"plan\", \"goodsid\");\n\t\tput(\"period\", \"week\");\n\t\tput(\"period_duration\", \"2\");\n\t}});\n\treturn subscription.get(\"id\");\n\n#### Subscription - cancel\n\n\tSubscription subscription = new Subscription(\"SUBSCRIPTION_ID\");\n\t\tsubscription = (Subscription)(subscription.cancel());\n\treturn subscription.isActive();\n\n### Signature calculation - Widget\n\n\tSignature.Widget widgetSignatureModel = new Signature.Widget();\n\treturn widgetSignatureModel.calculate(\n\t\tnew LinkedHashMap\u003cString, ArrayList\u003cString\u003e\u003e(), // widget params\n\t\t2 // signature version\n\t);\n\n### Singature calculation - Pingback\n\n    Signature.Pingback pingbackSignatureModel = new Signature.Pingback();\n    return pingbackSignatureModel.calculate(\n        new LinkedHashMap\u003cString, ArrayList\u003cString\u003e\u003e(), // widget params\n        1 // signature version\n    );\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaymentwall%2Fpaymentwall-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaymentwall%2Fpaymentwall-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaymentwall%2Fpaymentwall-java/lists"}