Payment contexts are now known as payment types. Context information is no longer stored in $payment->context and $payment->context_data. Instead, payment types are Payment/Type<code> plugins that need to implement <code>\Drupal\payment\Plugin\Payment\Type\PaymentTypeInterface and can optionally extend \Drupal\payment\Plugin\Payment\Type\Base. Plugins should be annotated using \Drupal\payment\Annotations\PaymentType. They can be got from payment entities using \Drupal\payment\Entity\PaymentInterface::getPaymentType().
This change also introduced hook_payment_type_alter() and hook_payment_type_pre_resume_context().
7.x-1.x
// This context accepts an array of node IDs as part of its configuration.
$payment->context = 'foo_context';
$payment->context_data = array(
'nids' => array(1, 3, 97),
);
8.x-2.x
// This type accepts an array of node IDs as part of its configuration. the setNids() method is a custom example method on the example context.
$manager = \Drupal\payment\Payment::typeManager();
$type = $manager->createInstance('foo_context')
->setNids(array(1, 3, 97));
$payment = entity_create('payment', array(
'type' => $type,
));
As part of this change, Payment::finish_callback is now \Drupal\payment\Plugin\Payment\Type\PaymentTypeInterface::resumeContext().