Skip to content

Conversation

@abhix2112
Copy link
Contributor

Overview

This PR introduces the StripePaymentProcessor Script Include — a secure, server-side integration between ServiceNow and Stripe.
It enables full payment and subscription workflows through the Stripe Payment Widget on Service Portal pages.

The Script Include interacts with the Stripe REST API to create, confirm, and manage PaymentIntents and Subscriptions, providing a complete, PCI-compliant transaction flow directly within ServiceNow.


🔑 Key Features

  • 💳 Create and confirm Stripe PaymentIntents
  • 🔁 Manage Subscriptions (recurring billing)
  • 🔒 Uses Stripe Secret Key stored in system property (stripe_payment_key)
  • 📜 Logs transactions to u_transaction_history and webhooks to u_stripe_event_log
  • ⚙️ Reusable from widgets, scripts, or Flow Designer
  • 🌐 Compatible with both test and live Stripe environments

🔗 Integration Path

This backend Script Include connects directly with the Stripe Payment Widget from the companion PR:
🧭 Demo Page: /sp?id=stripe_payment_checkout

  1. User submits payment via widget
  2. Widget client script calls server script
  3. Server script invokes global.StripePaymentProcessor()
  4. PaymentIntent or subscription is created and confirmed via Stripe API
  5. Result and transaction details are logged back i

Copy link
Contributor

@wiz0floyd wiz0floyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears that a significant amount of AI was used to generate this script. Have you tested that it actually works? As this isn't exactly a small reusable snippet of code, I'm not sure that it's even a great fit for this repository.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be set up using connection and credential aliases so that non-prod can use a test api and credentials

recordid
);
var methodid = paymethod.payment_method_id;
var grUTH = new GlideRecord("u_transaction_history");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This table needs to be created and isn't mentioned in the readme.

Comment on lines +13 to +18
- 💳 Create and confirm **Stripe PaymentIntents**
- 🔁 Create and manage **Stripe Subscriptions**
- 🧠 Auto-link **PaymentMethods** with customers
- 💬 Update `u_transaction_history` and webhook logs automatically
- 🔒 Securely interacts with the Stripe API via REST
- 🌐 Fully dynamic REST message creation — no need for integrations in UI
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a significant amount of AI used here. How much original work is in this script?

payment_method: paymentData.payment_method_id,
confirmation_method: "automatic",
confirm: true,
return_url: "https://npsm.service.service-now.com/",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be updated for prod vs non prod.

@wiz0floyd wiz0floyd closed this Oct 21, 2025
@wiz0floyd
Copy link
Contributor

Please make the requested changes and reopen this pull request! Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants