I need to add paypal into my website. Your reply is very appreciated. Thank you.

Dani AI

Generated

Quick summary for : the modern, supported path is PayPal Checkout (client-side JS SDK) combined with a secure server-side call to the Orders v2 REST API (create order → approve on the client → capture on the server). That pattern keeps secrets off the browser and gives you reliable server notifications via Webhooks. was right to point you at the PayPal developer docs; ’s IPN suggestion is valid for older setups, but new integrations should use Checkout + Webhooks instead of relying on IPN. (paypal.ai)

Minimal, practical flow to implement (server + client):

  1. Create an app in the PayPal Developer Dashboard and get a Client ID and Secret (use sandbox for testing).
  2. Server: call POST /v2/checkout/orders to create an order and return the order ID to the page.
  3. Client: load the PayPal JS SDK and use the returned order ID for the approval flow.
  4. Server: after approval, capture the order with POST /v2/checkout/orders/{id}/capture and persist the result.
    A short C# sketch (using the .NET SDK pattern) — adapt to your project and error handling:
using PayPalCheckoutSdk.Core;
using PayPalCheckoutSdk.Orders;
using PayPalHttp;

var env = new SandboxEnvironment(clientId, clientSecret);
var client = new PayPalHttpClient(env);

var request = new OrdersCreateRequest();
request.Prefer("return=representation");
request.RequestBody(new OrderRequest {
  Intent = "CAPTURE",
  PurchaseUnits = new List<PurchaseUnitRequest> {
    new PurchaseUnitRequest {
      AmountWithBreakdown = new AmountWithBreakdown { CurrencyCode = "USD", Value = "10.00" }
    }
  }
});
var response = await client.Execute(request);
var order = response.Result<Order>();
// return order.Id to the browser for the JS SDK to approve

Use the official Orders docs as your API reference and the PayPal server SDK repo for examples. (docs.paypal.ai)

Troubleshooting and cautions

  • Test everything in sandbox and log raw responses. (paypal.ai)
  • Do not store client secrets in client-side code; use environment variables on the server. (paypal.ai)
  • Verify Webhook signatures (PayPal updated verification endpoints) and make your webhook handler idempotent (same event may be delivered more than once). (developer.paypal.com)
  • Always check capture status returned by the API before fulfilling an order; save PayPal’s order/transaction IDs so you can look up or refund later. (docs.paypal.ai)

This covers the current, maintainable approach (Checkout + Orders v2 + Webhooks). For step‑by‑step code, follow the PayPal Checkout server examples and the Orders API reference in the developer docs. (paypal.ai)

Resources: PayPal Checkout docs and Webhooks docs (use the Developer Dashboard sandbox for keys and account setup). (docs.paypal.ai)

Recommended Answers

All 3 Replies

There are several ways you can use Paypal on your site, it all depends on whether you want to use their shopping cart and session management or your own and whether you want your users to be redirected to paypal or stay within your site (except for the final payment). Head over to the developer section at Paypal, sign up (if you haven't already) and check out

Look at using the PayPal IPN. It let's you send variables to the service and if the transaction is successful you can define a method (or page) to access.

First, you need to enable the IPN in your PayPal account:
'My Profile -> My Selling Tools -> Getting paid and managing my risk -> Instant payment notifications -> Update
'Choose IPN Settings -> Type in notification url and tick Receive IPN messages (Enabled)

Then, on your Pay button, use something like:

Dim PaypalAccount As String = "your_payPal_account"



Dim URL As String = "" & PaypalAccount & "&cmd=_cart&upload=1&item_name_1=" & the_description_here & "&amount_1=" & the_dollar_value_here & "&quantity_1=1&currency_code=USD&on0=&invoice=" & unique_invoice_number & "&return=http://" & Request.ServerVariables("HTTP_HOST") & "/confirmed.aspx&cancel_return=http://" & Request.ServerVariables("HTTP_HOST") & "/declined.aspx&notify_url=http://" & Request.ServerVariables("HTTP_HOST") & "/some_page_here.aspx"

Response.Redirect(URL)

In the some_page_here.aspx, you can get the the return values from PayPal and finish the transaction (eg: write the confirmed values to your database.) The user will not see this page, they will get returned either to the approved or declined page.

Some of the values that get returned are: Request("invoice") Request("txn_type") Request("txn_id")
Read up on PayPal what these values are and what other values get returned.

Remember, the invoice value is important as it will be the original invoice number that you sent.

send me paypal steps,,and how to use and return and saveBold Text Here******

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.